IBM Mainframe Forum Index
 
Log In
 
IBM Mainframe Forum Index Mainframe: Search IBM Mainframe Forum: FAQ Register
 

passing records those positions divisible by one number


IBM Mainframe Forums -> JCL & VSAM
Post new topic   Reply to topic
View previous topic :: View next topic  
Author Message
donisati

New User


Joined: 12 Feb 2008
Posts: 1
Location: Hyderabad

PostPosted: Tue May 27, 2008 1:49 pm
Reply with quote

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
View user's profile Send private message
gcicchet

Senior Member


Joined: 28 Jul 2006
Posts: 1702
Location: Australia

PostPosted: Tue May 27, 2008 2:07 pm
Reply with quote

Hi,

please example of the data.


Gerry
Back to top
View user's profile Send private message
enrico-sorichetti

Superior Member


Joined: 14 Mar 2007
Posts: 10873
Location: italy

PostPosted: Tue May 27, 2008 3:35 pm
Reply with quote

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
View user's profile Send private message
vpr_118
Warnings : 1

New User


Joined: 07 Apr 2008
Posts: 64
Location: chennai

PostPosted: Tue May 27, 2008 3:48 pm
Reply with quote

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
View user's profile Send private message
sril.krishy

Active User


Joined: 30 Jul 2005
Posts: 183
Location: hyderabad

PostPosted: Tue May 27, 2008 5:38 pm
Reply with quote

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
View user's profile Send private message
shankar.v

Active User


Joined: 25 Jun 2007
Posts: 196
Location: Bangalore

PostPosted: Tue May 27, 2008 6:37 pm
Reply with quote

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
View user's profile Send private message
View previous topic :: :: View next topic  
Post new topic   Reply to topic View Bookmarks
All times are GMT + 6 Hours
Forum Index -> JCL & VSAM

 


Similar Topics
Topic Forum Replies
No new posts Compare 2 files and retrive records f... DFSORT/ICETOOL 0
No new posts Compare 2 files(F1 & F2) and writ... JCL & VSAM 8
No new posts Replacing 'YYMMDD' with date, varying... SYNCSORT 3
No new posts Compare only first records of the fil... SYNCSORT 7
No new posts Pulling a fixed number of records fro... DB2 2
Search our Forums:

Back to Top