Portal | Manuals | References | Downloads | Info | Programs | JCLs | Master the Mainframes
IBM Mainframe Computers Forums Index
 
Register
 
IBM Mainframe Computers Forums Index Mainframe: Search IBM Mainframe Forum: FAQ Memberlist Usergroups Profile Log in to check your private messages Log in
 

 

How to sort variable length format files using SORT card

 
Post new topic   Reply to topic    IBMMAINFRAMES.com Support Forums -> JCL & VSAM
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    Post subject: How to sort variable length format files using SORT card
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: 1288
Location: Chennai, India

PostPosted: Tue Oct 23, 2007 10:26 am    Post subject: Reply to: How to sort variable length format files using SOR
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    Post subject: Reply to: How to sort variable length format files using SOR
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: 1288
Location: Chennai, India

PostPosted: Tue Oct 23, 2007 11:04 am    Post subject: Reply to: How to sort variable length format files using SOR
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: 1288
Location: Chennai, India

PostPosted: Tue Oct 23, 2007 11:09 am    Post subject: Reply to: How to sort variable length format files using SOR
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    Post subject: Reply to: How to sort variable length format files using SOR
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: 1288
Location: Chennai, India

PostPosted: Tue Oct 23, 2007 11:14 am    Post subject: Reply to: How to sort variable length format files using SOR
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    Post subject: Reply to: How to sort variable length format files using SOR
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: 1288
Location: Chennai, India

PostPosted: Tue Oct 23, 2007 12:03 pm    Post subject: Reply to: How to sort variable length format files using SOR
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    Post subject: hi
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    IBMMAINFRAMES.com Support Forums -> JCL & VSAM All times are GMT + 6 Hours
Page 1 of 1

 

Search our Forum:

Similar Topics
Topic Author Forum Replies Posted
No new posts How to change 'K' or 'M' use Sort vice_versa DFSORT/ICETOOL 5 Thu May 18, 2017 7:11 am
No new posts Converting Variable block file to Fix... bhavana yalavarthi DFSORT/ICETOOL 10 Tue May 16, 2017 2:20 pm
No new posts Adding big TEXT lines to each record ... bshkris SYNCSORT 4 Sat May 06, 2017 1:40 am
No new posts Unable to create multiple files using... mbattu COBOL Programming 3 Fri May 05, 2017 5:35 pm
No new posts Getting error while opening a variabl... apandey1 COBOL Programming 5 Fri May 05, 2017 12:22 pm


Facebook
Back to Top
 
Mainframe Wiki | Forum Rules | Bookmarks | Subscriptions | FAQ | Tutorials | Contact Us