View previous topic :: View next topic
Author
Message
donisati New User Joined: 12 Feb 2008Posts: 1 Location: Hyderabad
Hi All,
One input file containg 100 records of length 120,So i need to put all the records those are divisible by 2 in file1 and divisible ny 4 in file2 and remaining are in file 3
how i can do this.......
Thanks & Regards
D.Satheesh
Back to top
gcicchet Senior Member Joined: 28 Jul 2006Posts: 1702 Location: Australia
Hi,
please example of the data.
Gerry
Back to top
enrico-sorichetti Superior Member Joined: 14 Mar 2007Posts: 10873 Location: italy
write a program with
one input file
three output files
keep the record counter and carry on the approprate modulus computations
remember to compute the modulo 2 after the modulo 4
otherwise the modulo 4 path will never be taken
write to the output file accordingly
JCL WILL NOT DO IT FOR YOU....
the alternatives are a RYO program ( HLL, easytrieve, SAS, REXX script )
or a &sort family &fileaid family utilkity with the proper processing options
Back to top
vpr_118 Warnings : 1 New User Joined: 07 Apr 2008Posts: 64 Location: chennai
You can use ICEMAN utility.
I am i right you want every fourth and every 2nd record separately in two different files.
//SYSIN DD *
SORT FIELDS=COPY
OUTFIL FNAMES=(OUT1,OUT2,OUT3,OUT4),SPLIT
/*
OUT4 will have very 4th record and OUT2 will have every second record.
Thanks
Back to top
sril.krishy Active User Joined: 30 Jul 2005Posts: 183 Location: hyderabad
D.Satheesh,
Please check the below code.
Code:
//PS020 EXEC PGM=SYNCTOOL
//SYSOUT DD SYSOUT=*
//TOOLMSG DD SYSOUT=*
//DFSMSG DD SYSOUT=*
//IN DD *
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
//OUT1 DD SYSOUT=*
//TEMP DD DSN=&&T2,DISP=(,PASS),SPACE=(CYL,(1,2),RLSE)
//OUT2 DD SYSOUT=*
//OUT3 DD SYSOUT=*
//TOOLIN DD *
SORT FROM(IN) TO(TEMP) USING(CTL1)
COPY FROM(TEMP) USING(CTL2)
//CTL1CNTL DD *
SORT FIELDS=COPY
INREC FIELDS=(1,5,SEQNUM,8,ZD)
OUTREC FIELDS=(1,5,6,8,ZD,MOD,+2,EDIT=(TT),1X,
6,8,ZD,MOD,+4,EDIT=(TT))
//CTL2CNTL DD *
OPTION COPY
OUTFIL FNAMES=OUT1,INCLUDE=(6,2,CH,EQ,C'01'),OUTREC=(1,5)
OUTFIL FNAMES=OUT2,INCLUDE=(6,2,CH,EQ,C'00'),OUTREC=(1,5)
OUTFIL FNAMES=OUT3,INCLUDE=(09,2,CH,EQ,C'00'),OUTREC=(1,5)
Code:
out1:
1
3
5
7
9
11
13
15
17
19
out2:
2
4
6
8
10
12
14
16
18
20
out3:
4
8
12
16
20
Thanks
Krishy
Back to top
shankar.v Active User Joined: 25 Jun 2007Posts: 196 Location: Bangalore
Hi donisati,
Please check with the following code for your requirement.
Code:
// EXEC PGM=SORT
//SYSOUT DD SYSOUT=*
//SORTIN DD DSN=INPUT.FILE,DISP=SHR
//OUT1 DD DSN=OUT1,DISP=...
//OUT2 DD DSN=OUT2,DISP=...
//OUT3 DD DSN=OUT3,DISP=...
//SYSIN DD *
OPTION COPY
OUTFIL FNAMES=OUT1,STARTREC=2,SAMPLE=(2,1)
OUTFIL FNAMES=OUT2,STARTREC=4,SAMPLE=(4,1)
OUTFIL FNAMES=OUT3,SAVE
/*
//
Thanks,
Shankar
Back to top
Please enable JavaScript!