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

How to sort variable length format files using SORT card


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

New User


Joined: 15 Sep 2005
Posts: 42

PostPosted: Tue Oct 23, 2007 10:22 am
Reply with quote

I'm struggling with SORT card to sort the variable length format.

I used the following code

Code:

//STEP1 EXEC  PGM=SORT                                             
//SYSOUT   DD   SYSOUT=*                                           
//SORTIN   DD   DSN=SAB67D.G4662V00.TEST,DISP=SHR   
//SORTOUT  DD DSN=DFG37D.DFG0GF.TEST,                               
//            DISP=(NEW,CATLG,DELETE),                                       
//            SPACE=(TRK,(10,10),RLSE)                             
//SYSIN    DD *                                                     
  OPTION COPY,VLSHRT                                               
  INCLUDE COND=(85,1,CH,EQ,C'Y',1,3,ZD,CH,120)                     
/*                                                                 


85 position contains character
1 to 3 postion contains numeric fileds.

And I need output file with 2 bytes stating from 4 to 5th positions in the input file. These two bytes are comp-3 value.


Thanks,
Sridevi
Back to top
View user's profile Send private message
Aaru

Senior Member


Joined: 03 Jul 2007
Posts: 1287
Location: Chennai, India

PostPosted: Tue Oct 23, 2007 10:26 am
Reply with quote

Sridevi,

In a VB file the first 4 bytes are for RDW (which have the length of the record ans zeroes). You need to add four bytes in all the sort conditions.

If your field starts from position 1 of length 2- code 5,2

Code and post the error if you still face the problem
Back to top
View user's profile Send private message
sridevi2005

New User


Joined: 15 Sep 2005
Posts: 42

PostPosted: Tue Oct 23, 2007 10:57 am
Reply with quote

Hi,

Thank u very much for the reply.

I have used the following code its working fine.

//STEP1 EXEC PGM=SORT
//SYSOUT DD SYSOUT=*
//SORTIN DD DSN=SAB67D.G4662V00.TEST,DISP=SHR
//SORTOUT DD DSN=DFG37D.DFG0GF.TEST,
// DISP=(NEW,CATLG,DELETE),
// SPACE=(TRK,(10,10),RLSE),
// DCB=*.SORTIN
//SYSIN DD *
OPTION VLSHRT
SORT FIELDS=COPY
INCLUDE COND=(89,1,CH,EQ,C'Y',AND,5,3,ZD,EQ,120)

But When I tried the following code its giving error.

//STEP1 EXEC PGM=SORT
//SYSOUT DD SYSOUT=*
//SORTIN DD DSN=SAB67D.G4662V00.TEST,DISP=SHR
//SORTOUT DD DSN=DFG37D.DFG0GF.TEST,
// DISP=(NEW,CATLG,DELETE),
// SPACE=(TRK,(10,10),RLSE),
// RECFM=FB,LRECL=10,DSORG=PS
//SYSIN DD *
OPTION VLSHRT
SORT FIELDS=COPY
INCLUDE COND=(89,1,CH,EQ,C'Y',AND,5,3,ZD,EQ,120)
OUTREC FIELDS=(8,2)

Can u look into this.

Thanks in advance.

Sridevi
Back to top
View user's profile Send private message
Aaru

Senior Member


Joined: 03 Jul 2007
Posts: 1287
Location: Chennai, India

PostPosted: Tue Oct 23, 2007 11:04 am
Reply with quote

Please Post the error message that you are getting
Back to top
View user's profile Send private message
Aaru

Senior Member


Joined: 03 Jul 2007
Posts: 1287
Location: Chennai, India

PostPosted: Tue Oct 23, 2007 11:09 am
Reply with quote

Srideivi,

Replace your last statement in the SORT card with the one given below

Code:
OUTREC BUILD=(1,4,8,2)
Back to top
View user's profile Send private message
sridevi2005

New User


Joined: 15 Sep 2005
Posts: 42

PostPosted: Tue Oct 23, 2007 11:10 am
Reply with quote

Hi,

I'm getting the following error.

WER146B 20K BYTES OF EMERGENCY SPACE ALLOCATED
WER108I SORTIN : RECFM=VB ; LRECL= 288; BLKSIZE= 27998
WER235A OUTREC RDW NOT INCLUDED
WER449I SYNCSORT GLOBAL DSM SUBSYSTEM ACTIVE
Back to top
View user's profile Send private message
Aaru

Senior Member


Joined: 03 Jul 2007
Posts: 1287
Location: Chennai, India

PostPosted: Tue Oct 23, 2007 11:14 am
Reply with quote

Sridevi,

Change the last statement as per my last post.


Whenever you use BUILD parameter for VB datasets, you must begin your INREC/OUTREC statement fields by specifying 1,4 for RDW.
Back to top
View user's profile Send private message
sridevi2005

New User


Joined: 15 Sep 2005
Posts: 42

PostPosted: Tue Oct 23, 2007 11:33 am
Reply with quote

Wow......

Its working fine.

Thank u very much for your support.
Back to top
View user's profile Send private message
Aaru

Senior Member


Joined: 03 Jul 2007
Posts: 1287
Location: Chennai, India

PostPosted: Tue Oct 23, 2007 12:03 pm
Reply with quote

You are welcome icon_biggrin.gif
Back to top
View user's profile Send private message
jmreddymca
Warnings : 1

New User


Joined: 14 Oct 2007
Posts: 29
Location: Bangalore

PostPosted: Wed Oct 24, 2007 3:17 pm
Reply with quote

Hi sridevi

we can do in this way also it will work fine.

//SYSIN DD *
SORT FIELDS=COPY
OUTREC FIELDS=(1:5,150),VTOF
/*

my i/p file length hs 255
i copied this into fb length of 150 .
you can try.
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 3
No new posts Compare 2 files(F1 & F2) and writ... JCL & VSAM 8
No new posts Store the data for fixed length COBOL Programming 1
No new posts Need to set RC4 through JCL SORT DFSORT/ICETOOL 5
No new posts How to split large record length file... DFSORT/ICETOOL 10
Search our Forums:

Back to Top