VB to multiple FB files using sort, but with a condition.

SyncSort's Sort Product, SyncTool for z/OS, SYNCINIT and SYNCLIST.
Previous topicNext topic

Topic Author
Dark Fantasy
New Member
Posts: 8
Joined: Sun Dec 08, 2013 12:54 am

VB to multiple FB files using sort, but with a condition.

Post by Dark Fantasy » Mon Jul 28, 2014 2:21 pm

Hi,

I've an input variable block file.The data file is like this:

Code: Select all

FD004A001<some varibale data> 
FD004A001<some varibale data> 
FD005A001<some varibale data> 
FD005A002<some varibale data> 
.
.
.
FD100A006<some varibale data> 
All the records records can be in any sequence. I need the records starting with FD004 all in one file, FD005 in one file and so on. All these files should be FB.

I tried the following:

Code: Select all

//STEP01   EXEC PGM=SORT                     
//SORTIN   DD  DSN=MY.INPUT.FILE,      --> vb, recl - 2053
//             DISP=SHR                                  
//SORTOF01 DD  DSN=FILE004.OUTPUT.FILE,      
//             UNIT=(,5),SPACE=(1,(20,20),RLSE),AVGREC=M, 
//             DATACLAS=SXXXFB,LRECL=256,                
//             DISP=(,CATLG,DELETE)                      
//SORTOF02 DD  DSN=FILE005.OUTPUT.FILE,      
//             UNIT=(,5),SPACE=(1,(20,20),RLSE),AVGREC=M, 
//             DATACLAS=SXXXFB,LRECL=89,                  
//             DISP=(,CATLG,DELETE)                      
//SYSIN    DD  *                
SORT   FIELDS=COPY                    
OUTREC FIELDS=(1,2049),CONVERT        
OUTFIL FILES=01,                      
       INCLUDE=(1,5,CH,EQ,C'F0004')  
OUTFIL FILES=02,                      
       INCLUDE=(1,5,CH,EQ,C'F0005')  
Above job executes correct but the required records are not copied. Please help.



User avatar

Anuj Dhawan
Founder
Posts: 2624
Joined: Sun Apr 21, 2013 7:40 pm
Location: Mumbai, India
Zodiac: Sagittarius

Re: VB to multiple FB files using sort, but with a condition

Post by Anuj Dhawan » Tue Jul 29, 2014 1:35 pm

Hi,

Your Job looks good to me apart from that you should have used field start position as 5. As you're using VB files - on the OUTREC you should use 5 as start position. Said that, try this and you should be good:

Code: Select all

 SORT   FIELDS=COPY                    
 OUTREC FIELDS=(5,2049),CONVERT        
 OUTFIL FILES=01,INCLUDE=(1,5,CH,EQ,C'F0004')  
 OUTFIL FILES=02,INCLUDE=(1,5,CH,EQ,C'F0005')  


Thanks,
Anuj

Disclaimer: My comments on this website are my own and do not represent the opinions or suggestions of any other person or business entity, in any way.


Topic Author
Dark Fantasy
New Member
Posts: 8
Joined: Sun Dec 08, 2013 12:54 am

Re: VB to multiple FB files using sort, but with a condition

Post by Dark Fantasy » Wed Jul 30, 2014 1:43 pm

Thanks Anuj this has worked but why do you use '5' as starting position?




Topic Author
Dark Fantasy
New Member
Posts: 8
Joined: Sun Dec 08, 2013 12:54 am

Re: VB to multiple FB files using sort, but with a condition

Post by Dark Fantasy » Thu Jul 31, 2014 1:23 pm

Thanks Anuj this has worked but why do you use '5' as starting position?



User avatar

Anuj Dhawan
Founder
Posts: 2624
Joined: Sun Apr 21, 2013 7:40 pm
Location: Mumbai, India
Zodiac: Sagittarius

Re: VB to multiple FB files using sort, but with a condition

Post by Anuj Dhawan » Thu Jul 31, 2014 4:49 pm

You're using a variable-block file for which the data starts at position 5 - first 4 bytes are reserved for record descriptor word (RDW).

In RDW the first 2 bytes contain the length of the logical record. The last 2 bytes must be 0 because these are used for spanned records. When using variable-length records on output, you must provide the RDW; for input, the operating system provides the RDW.

Here is an image from IBM to describe more about RDW:

[center]Image[/center]

Hope this helps.


Thanks,
Anuj

Disclaimer: My comments on this website are my own and do not represent the opinions or suggestions of any other person or business entity, in any way.


Topic Author
Dark Fantasy
New Member
Posts: 8
Joined: Sun Dec 08, 2013 12:54 am

Re: VB to multiple FB files using sort, but with a condition

Post by Dark Fantasy » Fri Aug 08, 2014 2:35 pm

Thanks Anuj.



User avatar

Anuj Dhawan
Founder
Posts: 2624
Joined: Sun Apr 21, 2013 7:40 pm
Location: Mumbai, India
Zodiac: Sagittarius

Re: VB to multiple FB files using sort, but with a condition

Post by Anuj Dhawan » Fri Aug 08, 2014 6:51 pm

You're welcome! :)


Thanks,
Anuj

Disclaimer: My comments on this website are my own and do not represent the opinions or suggestions of any other person or business entity, in any way.

Previous topicNext topic

Return to “SyncSort, SyncTool, SyncGener.”