Hi,
Can a sort card be wriiten to copy data from first column of a file and paste in the 16th column of the same file?
Please suggest me on this.
Sort to copy data from first column from a file and paste it
Moderators: Frank Yaeger, Moderator Group
-
- Active Member
- Posts: 732
- Joined: Thu May 24, 2012 4:07 am
-
- Moderator
- Posts: 1625
- Joined: Sat Aug 09, 2008 9:02 am
- Location: Mumbai, India
- Frank Yaeger
- Moderator
- Posts: 812
- Joined: Sat Feb 18, 2006 5:45 am
- Location: San Jose, CA
- Contact:
archup20,
Well, you can use the same file for input and output if you do a SORT, but it's NOT really recommended since if something goes wrong you could lose your data set.
If you really want to do it, a DFSORT job like the following would work. I assumed your input file has RECFM=FB and LRECL=80, but the job can be changed appropriately for other attributes:
If you are worried about losing the data set, a better approach would be to use two copy passes like this:
Well, you can use the same file for input and output if you do a SORT, but it's NOT really recommended since if something goes wrong you could lose your data set.
If you really want to do it, a DFSORT job like the following would work. I assumed your input file has RECFM=FB and LRECL=80, but the job can be changed appropriately for other attributes:
Code: Select all
//S1 EXEC PGM=SORT
//SYSOUT DD SYSOUT=*
//SORTIN DD DISP=SHR,DSN=file
//SORTOUT DD DISP=OLD,DSN=file
//SYSIN DD *
INREC OVERLAY=(16:1,1,81:SEQNUM,8,ZD)
SORT FIELDS=(81,8,ZD,A)
OUTREC BUILD=(1,80)
Code: Select all
//S1 EXEC PGM=ICETOOL
//TOOLMSG DD SYSOUT=*
//DFSMSG DD SYSOUT=*
//IN DD DISP=OLD,DSN=file
//T1 DD DSN=&&T1,UNIT=SYSDA,SPACE=(CYL,(5,5)),DISP=(,PASS)
//TOOLIN DD *
COPY FROM(IN) TO(T1) USING(CTL1)
COPY FROM(T1) TO(IN)
//CTL1CNTL DD *
INREC OVERLAY=(16:1,1)
Frank Yaeger - DFSORT Development Team (IBM) - yaeger@us.ibm.com
Specialties: JOINKEYS, FINDREP, WHEN=GROUP, ICETOOL, Symbols, Migration
=> DFSORT/MVS is on the Web at http://www.ibm.com/storage/dfsort
Specialties: JOINKEYS, FINDREP, WHEN=GROUP, ICETOOL, Symbols, Migration
=> DFSORT/MVS is on the Web at http://www.ibm.com/storage/dfsort
FREE TUTORIALS
Tutorials
Free tutorials from mainframegurukul
- JCL Tutorial
Covers all important JCL concepts. - Cobol Tutorial
This tutorials covers all Cobol Topics from STRING to COMP-3. - DB2 Tutorial
DB2 Tutorial focuses on DB2 COBOL Programming. - SORT Tutorial
This Tutorial covers all important aspects of DFSORT with examples - CICS Tutorial
This CICS tutorial covers CICS concepts and CICS Basics, CICS COBOL Programming.
Interview
Mainframe Interview questions
- Cobol Interview Questions
50+ Interview Questions - JCL Interview Questions
50+ Interview Questions - DB2 Interview Questions
100+ Interview Questions - CICS Interview Questions
70+ Interview Questions - VSAM Interview Questions
27 Interview Questions
Other References
Mainframe Tools and others
- XPEDITER Reference
Explains how we can debug a program - FILEAID Reference
Explains how to browse , edit and delete datasets - Change Man Reference
Quick Start tutorial on Changeman - Abend Reference
Important Abend codes explained - FaceBook Page
MainframeGurukul FaceBook Page - LinkedIn Page
MainframeGurkul Linkedin Page