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

SyncSort's Sort Product, SyncTool for z/OS, SYNCINIT and SYNCLIST.
Post Reply
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 »

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: 2799
Joined: Sun Apr 21, 2013 7:40 pm
Location: Mumbai, India
Contact:
India

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

Post by Anuj Dhawan »

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.
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 »

Thanks Anuj this has worked but why do you use '5' as starting position?
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 »

Thanks Anuj this has worked but why do you use '5' as starting position?
User avatar
Anuj Dhawan
Founder
Posts: 2799
Joined: Sun Apr 21, 2013 7:40 pm
Location: Mumbai, India
Contact:
India

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

Post by Anuj Dhawan »

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.
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 »

Thanks Anuj.
User avatar
Anuj Dhawan
Founder
Posts: 2799
Joined: Sun Apr 21, 2013 7:40 pm
Location: Mumbai, India
Contact:
India

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

Post by Anuj Dhawan »

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.
Post Reply

Create an account or sign in to join the discussion

You need to be a member in order to post a reply

Create an account

Not a member? register to join our community
Members can start their own topics & subscribe to topics
It’s free and only takes a minute

Register

Sign in

Return to “SyncSort, SyncTool, SyncGener.”