MVSFORUMS.com Forum Index MVSFORUMS.com
A Community of and for MVS Professionals
 
 FAQFAQ   SearchSearch   Quick Manuals   RegisterRegister 
 ProfileProfile   Log in to check your private messagesLog in to check your private messages   Log inLog in 

Create Sort card from 2 different Input file

 
Post new topic   Reply to topic   printer-friendly view    MVSFORUMS.com Forum Index -> Utilities
View previous topic :: View next topic  
Author Message
Sqlcode
Intermediate


Joined: 15 Dec 2006
Posts: 157
Topics: 38

PostPosted: Tue Sep 02, 2008 12:57 pm    Post subject: Create Sort card from 2 different Input file Reply with quote

I have input files as mentioned below :

Code:

01000000000000000200411111111111
02200422222222222200533333333333
03200544444444444200555555555555


Code:

 OPTION COPY                                             
 OUTFIL INCLUDE=(1,15,CH,GE,C'XXXXXXXXXXXXXXX',AND,   
              1,15,CH,LE,C'YYYYYYYYYYYYYYY'),FNAMES=OUT1
 OUTFIL INCLUDE=(1,15,CH,GE,C'XXXXXXXXXXXXXXX',AND,     
              1,15,CH,LE,C'YYYYYYYYYYYYYYY'),FNAMES=OUT2
 OUTFIL INCLUDE=(1,15,CH,GE,C'XXXXXXXXXXXXXXX',AND,     
              1,15,CH,LE,C'YYYYYYYYYYYYYYY'),FNAMES=OUT3


I am trying to replace all XXXXXs with column 3-17 (Leng = 15). Similarly all YYYYYs should be replaced with column 18-32 (Leng = 15).


Output should be as mentioned below :

Code:

 OPTION COPY                                             
 OUTFIL INCLUDE=(1,15,CH,GE,C'000000000000000',AND,   
              1,15,CH,LE,C'200411111111111'),FNAMES=OUT1
 OUTFIL INCLUDE=(1,15,CH,GE,C'200422222222222',AND,     
              1,15,CH,LE,C'200533333333333'),FNAMES=OUT2
 OUTFIL INCLUDE=(1,15,CH,GE,C'200544444444444',AND,     
              1,15,CH,LE,C'200555555555555'),FNAMES=OUT3


Can this be achieved through SORT?
Back to top
View user's profile Send private message
Frank Yaeger
Sort Forum Moderator
Sort Forum Moderator


Joined: 02 Dec 2002
Posts: 1618
Topics: 31
Location: San Jose

PostPosted: Tue Sep 02, 2008 1:14 pm    Post subject: Reply with quote

Do you have to modify the records in the second file? Based on your example, it would actually be easier to just generate the control statements you need as a new file rather than replacing the records in the old file. Do you want me to show you how to generate the control statements in a new file?
_________________
Frank Yaeger - DFSORT Development Team (IBM)
Specialties: JOINKEYS, FINDREP, WHEN=GROUP, ICETOOL, Symbols, Migration
DFSORT is on the Web at:
www.ibm.com/storage/dfsort
Back to top
View user's profile Send private message Send e-mail Visit poster's website
Sqlcode
Intermediate


Joined: 15 Dec 2006
Posts: 157
Topics: 38

PostPosted: Tue Sep 02, 2008 1:19 pm    Post subject: Reply with quote

I need to modify records in second file.

First file is generated from different process and it will actually contain different range for each day. Its a daily process and I am generating SORT Control card based on range in input file.

We can generate control statement as well if that's easier.

But I am curious to know if its possible to modify records from file-1?

Would you mind giving me both the solutions if its feasible?
Back to top
View user's profile Send private message
kolusu
Site Admin
Site Admin


Joined: 26 Nov 2002
Posts: 12380
Topics: 75
Location: San Jose

PostPosted: Tue Sep 02, 2008 1:34 pm    Post subject: Reply with quote

rajen,

It is very easy to generate the control statements. Here is a DFSORT JCL which will give you the desired results

Code:

//STEP0100 EXEC PGM=ICEMAN                                         
//SYSOUT   DD SYSOUT=*                                             
//SORTIN   DD *                                                     
01000000000000000200411111111111                                   
02200422222222222200533333333333                                   
03200544444444444200555555555555                                   
//SORTOUT  DD SYSOUT=*                                             
//SYSIN    DD *                                                     
  OPTION STOPAFT=3                                                 
  SORT FIELDS=COPY                                                 
  OUTFIL REMOVECC,HEADER1=(2:'OPTION COPY'),                       
  BUILD=(02:C'OUTFIL INCLUDE=(1,15,CH,GE,C''',3,15,C'''',C',AND,',/,
         18:C'1,15,CH,LE,C''',18,15,C'''',C'),FNAMES=OUT',         
         SEQNUM,1,ZD,80:X)                                         
/*                                                                 


The output from the above job is
Code:

 OPTION COPY                                               
 OUTFIL INCLUDE=(1,15,CH,GE,C'000000000000000',AND,         
                1,15,CH,LE,C'200411111111111'),FNAMES=OUT1
 OUTFIL INCLUDE=(1,15,CH,GE,C'200422222222222',AND,         
                1,15,CH,LE,C'200533333333333'),FNAMES=OUT2
 OUTFIL INCLUDE=(1,15,CH,GE,C'200544444444444',AND,         
                1,15,CH,LE,C'200555555555555'),FNAMES=OUT3

Hope this helps....

Cheers
_________________
Kolusu
www.linkedin.com/in/kolusu
Back to top
View user's profile Send private message Send e-mail Visit poster's website
Sqlcode
Intermediate


Joined: 15 Dec 2006
Posts: 157
Topics: 38

PostPosted: Tue Sep 02, 2008 1:43 pm    Post subject: Reply with quote

Wow....that did worked!!! Smile

Little modification to this req. In the actual input file I will have final record with only 1 value and I need all the records GREATER THAN that value

Input File 1 :

01000000000000000200411111111111
02200422222222222200533333333333
03200544444444444200555555555555
04999999999999999


Output Should Be :-

OPTION COPY
OUTFIL INCLUDE=(1,15,CH,GE,C'000000000000000',AND,
1,15,CH,LE,C'200411111111111'),FNAMES=OUT1
OUTFIL INCLUDE=(1,15,CH,GE,C'200422222222222',AND,
1,15,CH,LE,C'200533333333333'),FNAMES=OUT2
OUTFIL INCLUDE=(1,15,CH,GE,C'200544444444444',AND,
1,15,CH,LE,C'200555555555555'),FNAMES=OUT3
OUTFIL INCLUDE=(1,15,CH,GE,C'999999999999999'),FNAMES=OUT4

I apologize for not mentioning this earlier.
Back to top
View user's profile Send private message
Sqlcode
Intermediate


Joined: 15 Dec 2006
Posts: 157
Topics: 38

PostPosted: Tue Sep 02, 2008 2:15 pm    Post subject: Reply with quote

Ok, I get it.

The only problem is FNAMES.

Below is the JCL i am using :


Code:
//STEP0100 EXEC PGM=ICEMAN                                             
//SYSOUT   DD SYSOUT=*                                                 
//SORTIN   DD *                                                         
01000000000000000200411111111111                                       
02200422222222222200533333333333                                       
03200544444444444200555555555555                                       
04999999999999999                                                       
//SORTOUT  DD SYSOUT=*                                                 
//SYSIN    DD *                                                         
  OPTION STOPAFT=04                                                     
  SORT FIELDS=COPY                                                     
  OUTFIL REMOVECC,HEADER1=(2:'OPTION COPY'),                           
  IFTHEN=(WHEN=(1,2,ZD,LE,03),                                         
  BUILD=(02:C'OUTFIL INCLUDE=(1,15,CH,GE,C''',3,15,C'''',C',AND,',/,   
         18:C'1,15,CH,LE,C''',18,15,C'''',C'),FNAMES=OUT',             
         SEQNUM,2,ZD,80:X)),                                           
  IFTHEN=(WHEN=(1,2,ZD,EQ,04),                                         
  BUILD=(02:C'OUTFIL INCLUDE=(1,15,CH,GE,C''',3,15,C'''',C'),',/,       
         49:C'FNAMES=OUT',SEQNUM,2,ZD,80:X))                           
/*


Could anyone please suggest me how to continue numbering for the final record?
Back to top
View user's profile Send private message
kolusu
Site Admin
Site Admin


Joined: 26 Nov 2002
Posts: 12380
Topics: 75
Location: San Jose

PostPosted: Tue Sep 02, 2008 2:21 pm    Post subject: Reply with quote

rajen,

You already have the sequence numbers in cols 1 and 2 , use them. The following DFSORT control cards will give you the desired results

Code:

//SYSIN    DD *                                                     
  OPTION STOPAFT=4                                                   
  SORT FIELDS=COPY                                                   
  OUTFIL REMOVECC,IFOUTLEN=80,HEADER1=(2:'OPTION COPY'),             
  IFTHEN=(WHEN=(1,2,ZD,LE,3),                                       
  BUILD=(02:C'OUTFIL INCLUDE=(1,15,CH,GE,C''',3,15,C'''',C',AND,',/,
         18:C'1,15,CH,LE,C''',18,15,C'''',C'),FNAMES=OUT',1,2,80:X)),
  IFTHEN=(WHEN=(1,2,ZD,EQ,4),                                       
  BUILD=(02:C'OUTFIL INCLUDE=(1,15,CH,GE,C''',3,15,C'''',           
            C'),FNAMES=OUT',1,2))                                   
/*                                                                   


Hope this helps...

Cheers
_________________
Kolusu
www.linkedin.com/in/kolusu
Back to top
View user's profile Send private message Send e-mail Visit poster's website
Sqlcode
Intermediate


Joined: 15 Dec 2006
Posts: 157
Topics: 38

PostPosted: Tue Sep 02, 2008 2:46 pm    Post subject: Reply with quote

It worked.

Thanks Kolusu.
Back to top
View user's profile Send private message
kolusu
Site Admin
Site Admin


Joined: 26 Nov 2002
Posts: 12380
Topics: 75
Location: San Jose

PostPosted: Tue Sep 02, 2008 3:02 pm    Post subject: Reply with quote

rajen,

If you really want to update the existing control cards then use the following JCL. The first step creates symbols with substitution values and the second step overlays the contents from the symbols

Code:

//STEP0100 EXEC PGM=ICEMAN                                   
//SYSOUT   DD SYSOUT=*                                       
//SORTIN   DD *                                             
01000000000000000200411111111111                             
02200422222222222200533333333333                             
03200544444444444200555555555555                             
04999999999999999                                           
//SORTOUT  DD DSN=&&T1,DISP=(,PASS),SPACE=(TRK,(1,0),RLSE)   
//SYSIN    DD *                                             
  OPTION STOPAFT=4                                           
  SORT FIELDS=COPY                                           
  OUTFIL BUILD=(2:C'SYM',SEQNUM,1,ZD,START=1,INCR=2,C',C''',
                3,15,C'''',/,                               
                2:C'SYM',SEQNUM,1,ZD,START=2,INCR=2,C',C''',
                18,15,C'''',80:X)                           
/*     
//STEP0200 EXEC PGM=ICEMAN                                     
//SYSOUT   DD SYSOUT=*                                         
//SYMNAMES DD DSN=&&T1,DISP=SHR                                 
//SORTIN   DD *                                                 
 OPTION COPY                                                   
 OUTFIL INCLUDE=(1,15,CH,GE,C'AAAAAAAAAAAAAAA',AND,             
                 1,15,CH,LE,C'BBBBBBBBBBBBBBB'),FNAMES=OUT01   
 OUTFIL INCLUDE=(1,15,CH,GE,C'CCCCCCCCCCCCCCC',AND,             
                 1,15,CH,LE,C'DDDDDDDDDDDDDDD'),FNAMES=OUT02   
 OUTFIL INCLUDE=(1,15,CH,GE,C'EEEEEEEEEEEEEEE',AND,             
                 1,15,CH,LE,C'FFFFFFFFFFFFFFF'),FNAMES=OUT03   
 OUTFIL INCLUDE=(1,15,CH,GE,C'GGGGGGGGGGGGGGG'),FNAMES=OUT04   
//SORTOUT  DD SYSOUT=*                                         
//SYSIN    DD *                                                 
  SORT FIELDS=COPY                                             
  INREC IFOUTLEN=80,IFTHEN=(WHEN=INIT,OVERLAY=(81:SEQNUM,1,ZD)),
  IFTHEN=(WHEN=(81,1,ZD,EQ,2),OVERLAY=(31:SYM1)),               
  IFTHEN=(WHEN=(81,1,ZD,EQ,3),OVERLAY=(31:SYM2)),               
  IFTHEN=(WHEN=(81,1,ZD,EQ,4),OVERLAY=(31:SYM3)),               
  IFTHEN=(WHEN=(81,1,ZD,EQ,5),OVERLAY=(31:SYM4)),               
  IFTHEN=(WHEN=(81,1,ZD,EQ,6),OVERLAY=(31:SYM5)),               
  IFTHEN=(WHEN=(81,1,ZD,EQ,7),OVERLAY=(31:SYM6)),               
  IFTHEN=(WHEN=(81,1,ZD,EQ,8),OVERLAY=(31:SYM7))
/*


Hope this helps...

Cheers
_________________
Kolusu
www.linkedin.com/in/kolusu
Back to top
View user's profile Send private message Send e-mail Visit poster's website
Display posts from previous:   
Post new topic   Reply to topic   printer-friendly view    MVSFORUMS.com Forum Index -> Utilities All times are GMT - 5 Hours
Page 1 of 1

 
Jump to:  
You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot vote in polls in this forum


MVSFORUMS
Powered by phpBB © 2001, 2005 phpBB Group