View previous topic :: View next topic
Author
Message
stly Warnings : 1 New User Joined: 25 Jul 2005Posts: 93
i hav a records containing five columns.but i need to take the second and fifth column in to another ps.wats the code 4 it in jcl.
empno empname designation address salary i ahv actually but i need only empname and salary stored in my file.
thabks in advance
Back to top
nileshp New User Joined: 25 Feb 2006Posts: 31
Hi ,
You can use sort utility. And copy the required field into other ps.
Try the following
Code:
//SYSIN DD *
SORT FIELDS=COPY
INREC FIELDS=(7:2,5,20:10,3)
/*
EXPLANATION
1. SORT FIELDS=COPY
It is for copy records to output file
2. INREC FIELDS=(7:2,5,20:10,3) (for formatting)
Here we have two formatting,
1. 7:2,5 - data at 2nd position of input file with length 5
copied to 7th position of output file
2. 20:10,3 - data at 10th position of input file with length 3
copied to 20th position of output file
In above example, we can use OUTREC instead of INREC,
INREC adds, deletes, or reformat fields before the
records are sorted or merged. so that performance will
be improved
OUTREC adds, deletes, or reformat fields after the
records are sorted or merged.
stly wrote:
i hav a records containing five columns.but i need to take the second and fifth column in to another ps.wats the code 4 it in jcl.
empno empname designation address salary i ahv actually but i need only empname and salary stored in my file.
thanks in advance
Back to top
amitava Warnings : 1 Active User Joined: 30 Oct 2005Posts: 186 Location: India
Hey Stly,
Just check out this sort step
Code:
//JSTY0010 EXEC PGM=SORT
//SYSOUT DD SYSOUT=*
//SYSABEND DD SYSOUT=*
//SYSDUMP DD SYSOUT=*
//SORTIN DD DSN=<INPUT_DSN>,
// DISP=SHR
//SORTOUT DD DSN=<OUTPUT_DSN>,
// DISP=(NEW,CATLG,DELETE),
// DCB=(RECFM=FB,LRECL=256,BLKSIZE=0),
// SPACE=(CYL,(1,4),RLSE)
//SYSIN DD *
SORT FIELDS=COPY
OUTREC FIELDS=(10,10,50,20)
/* | |---------------------------|
starting |---> Offset
column position
Back to top
Frank Yaeger DFSORT Developer Joined: 15 Feb 2005Posts: 7129 Location: San Jose, CA
stly,
If you're not familiar with DFSORT and DFSORT's ICETOOL, I'd suggest reading through "z/OS DFSORT: Getting Started". It's an excellent tutorial, with lots of examples, that will show you how to use DFSORT, DFSORT's ICETOOL and DFSORT Symbols. You can access it online, along with all of the other DFSORT books, from:
Use [URL] BBCode for External Links
Back to top
stly Warnings : 1 New User Joined: 25 Jul 2005Posts: 93
thank u very much to one n all.thank u very much frank.
Back to top
Please enable JavaScript!