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 

How to Sort Variable Block to Fixed Block file

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


Joined: 23 Dec 2002
Posts: 4
Topics: 2

PostPosted: Fri Feb 07, 2003 7:44 am    Post subject: How to Sort Variable Block to Fixed Block file Reply with quote

Here is my problem...

MY INPUT FILE IS OF VARIABLE RECORD LENGTH. I WANT TO CREATE A FILE BASED ON THE FOLLOWING CONDITIONS:
1.IT SHOULD BE A FIXED RECORD LENGTH FILE.
2.IT SHOULD CONTAIN ONLY 2 FILEDS FROM THE INPUT FILE,
1ST FIELD FROM POSITION 5 TO 7,
2ND FIELD FROM POSITION 61 TO 63.
3.IT SHOULD BE SORTED IN ASCENDING ORDER BASED ON THE 5TH TO 7TH POSITION OF THE INPUT FILE.
3.IT SHOULD OMIT A RECORD IF THE 5TH TO 7TH POSITION OF THE INPUT RECORD IS EQUAL TO '3DT'.


WE TRIED WITH THE FOLLOWING CONTROL CARD,

Code:

 INREC FIELDS=(1,4,5,3,61,3)    
 SORT FILEDS=(5,3,CH,A)
 OMIT COND=(5,3,CH,EQ,C'3DT')
 OUTREC FIELDS=(5,6,74X),CONVERT.


But we are getting abend. Please could help me resoving this...

Thanks,
Rchilla
_________________
Rchilla
Back to top
View user's profile Send private message
kolusu
Site Admin
Site Admin


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

PostPosted: Fri Feb 07, 2003 8:13 am    Post subject: Reply with quote

Rchilla,

Since the input file is a variable file the actual data starts in position 5 ( the first 4 bytes is RDW).so accordingly your sort fields will now change.So your fields in question actually start at 9 and 65 bytes respectively

Code:

//STEP0100 EXEC PGM=SORT
//*               
//SYSOUT   DD  SYSOUT=*               
//SORTIN   DD  DSN=YOUR INPUT VBFILE,
//             DISP=SHR             
//SORTOUT  DD  DSN=YOUR OUTPUT FBFILE,     
//             DISP=(NEW,CATLG,DELETE),               
//             UNIT=SYSDA,               
//             SPACE=(CYL,(X,Y),RLSE)             
//SYSIN    DD  * 
  SORT FIELDS=(9,3,CH,A)               
  OUTFIL CONVERT,OMIT=(9,3,CH,EQ,C'3DT'),
  OUTREC=(9,3,                             $ FLD1 STARTS AT 9 & LENGTH OF 3
          65,3,                            $ FLD2 STARTS AT 65 & LENGTH OF 3
          80:x)                            $ Pad with spaces for the rest of 74 bytes
/*


Hope this helps...

cheers

kolusu
Back to top
View user's profile Send private message Send e-mail Visit poster's website
Rchilla
Beginner


Joined: 23 Dec 2002
Posts: 4
Topics: 2

PostPosted: Fri Feb 07, 2003 9:01 am    Post subject: Reply with quote

Kolusu,

It's working fine...

Thank you

Rchilla.
_________________
Rchilla
Back to top
View user's profile Send private message
Premkumar
Moderator


Joined: 28 Nov 2002
Posts: 77
Topics: 7
Location: Chennai, India

PostPosted: Mon Feb 10, 2003 3:18 am    Post subject: Reply with quote

I would suggest to use the original sort cards with corrected field offsets.
Advantages are,

  1. it omits the '3DT' records before sorting. Less records to sort.
  2. it trims the records at INREC and expands the records at OUTREC. Less data for sort to handle, while sorting.
Back to top
View user's profile Send private message Send e-mail
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