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

Reformat a file using sort


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

Moderator Emeritus


Joined: 09 Mar 2011
Posts: 7309
Location: Inside the Matrix

PostPosted: Thu Aug 16, 2012 10:41 pm
Reply with quote

Make the change pointed out by Pandora-Box. I would always include at least one space, so that I know I've got "get" not something which begins with "get".

Also look to your OMIT. You can't do SEQ like that. You need to define where the GROUP PUSHed the SEQ and then test that for one.

If this doesn't get it, post the whole sysout.
Back to top
View user's profile Send private message
knickraj
Warnings : 1

New User


Joined: 11 Jun 2007
Posts: 50
Location: Euro

PostPosted: Thu Aug 16, 2012 11:24 pm
Reply with quote

try this..

Code:
//STEP EXEC SORT                                           
//SYSOUT   DD SYSOUT=*                                     
//SORTIN  DD *                                             
ABCDEFG.TXT                                                 
CD AAAAAA                                                   
CD BBBBBB                                                   
CD CCCCCCC                                                 
CD DDDDDDD                                                 
LOCSITE PRI=5 CY SEC=1 CY U=TESTDA REC=FB LR=1402 BLOCKSI=0
GET                                                         
USER.NONX.USER9999.SAMPLE(+1)'                             
QUIT                                                       
//SORTOUT  DD DSN=&&T,DISP=(,PASS),SPACE=(TRK,(1,0),RLSE)   
//SYSIN  DD *                                               
 OPTION COPY                                               
 OUTFIL REMOVECC,NODETAIL,BUILD=(80X),                     
   HEADER1=('FILE,C''',1,11,'''')                           
//STEP EXEC SORT                                           
//SYSOUT   DD SYSOUT=*                                     
//SYMNAMES DD DSN=&&T,DISP=SHR                             
//SORTOUT  DD SYSOUT=*                                     
//SORTIN  DD *                                             
ABCDEFG.TXT                                                 
CD AAAAAA                                                   
CD BBBBBB                                                   
CD CCCCCCC                                                 
CD DDDDDDD                                                 
LOCSITE PRI=5 CY SEC=1 CY U=TESTDA REC=FB LR=1402 BLOCKSI=0
GET                                                         
USER.NONX.USER9999.SAMPLE(+1)'                             
QUIT                                                       
//SYSIN  DD *                                               
 OPTION COPY                                               
 OMIT COND=(1,11,CH,EQ,FILE)                               
 INREC IFTHEN=(WHEN=(1,3,CH,EQ,C'GET'),OVERLAY=(5:FILE))
Back to top
View user's profile Send private message
dick scherrer

Moderator Emeritus


Joined: 23 Nov 2006
Posts: 19244
Location: Inside the Matrix

PostPosted: Fri Aug 17, 2012 12:01 am
Reply with quote

Hello,

Quote:
OUTFIL OMIT=(SEQ=1),BUILD=(1,80)
Suggest you try removing
OMIT=(SEQ=1), and try again.
Back to top
View user's profile Send private message
mksranjani

New User


Joined: 03 Feb 2010
Posts: 29
Location: Chennai

PostPosted: Fri Aug 17, 2012 8:18 am
Reply with quote

I have tried removing OMIT. Below is the error i got
Code:

 SYSIN :                                                                       
 SORT FIELDS=COPY                                                             
 INREC IFTHEN=(WHEN=GROUP,RECORDS=9,PUSH=(81:ID=1)),                           
       IFTHEN=(WHEN=(1,3,CH,EQ,C'get',AND,81,1,ZD,EQ,1),PUSH=(81:1,32))       
                                                        *                     
 OUTFIL BUILD=(1,80)                                                           
WER268A  INREC STATEMENT   : SYNTAX ERROR                                     
WER211B  SYNCSMF  CALLED BY SYNCSORT; RC=0000                                 
WER449I  SYNCSORT GLOBAL DSM SUBSYSTEM ACTIVE                                 
Back to top
View user's profile Send private message
dick scherrer

Moderator Emeritus


Joined: 23 Nov 2006
Posts: 19244
Location: Inside the Matrix

PostPosted: Fri Aug 17, 2012 8:34 am
Reply with quote

Hello,

What is the lrecl of the files?
Back to top
View user's profile Send private message
mksranjani

New User


Joined: 03 Feb 2010
Posts: 29
Location: Chennai

PostPosted: Fri Aug 17, 2012 8:36 am
Reply with quote

It is 80 bytes
Back to top
View user's profile Send private message
dick scherrer

Moderator Emeritus


Joined: 23 Nov 2006
Posts: 19244
Location: Inside the Matrix

PostPosted: Fri Aug 17, 2012 8:55 am
Reply with quote

Hello,

I have neither the documentation with me nor connectivity to a Syncsort system so i can't test.

PUSH=(81:1,32))
How was this determined?

Sorry i don't just have the answer, bit i'm kinda trying to deal with one error at a time . . . icon_confused.gif
Back to top
View user's profile Send private message
mksranjani

New User


Joined: 03 Feb 2010
Posts: 29
Location: Chennai

PostPosted: Fri Aug 17, 2012 9:02 am
Reply with quote

LRECL is 80 bytes, and the data in first line starts at col 1 with length 32.
Im not sure if this is correct. But I tried like this.
Back to top
View user's profile Send private message
Pandora-Box

Global Moderator


Joined: 07 Sep 2006
Posts: 1592
Location: Andromeda Galaxy

PostPosted: Fri Aug 17, 2012 9:56 am
Reply with quote

Infact the first push should suffice

Change ID=1 to 1,32

Use INCLUDE/OMIT to pic records that is needed then format GET record

Remove the second ifthen
Back to top
View user's profile Send private message
gcicchet

Senior Member


Joined: 28 Jul 2006
Posts: 1702
Location: Australia

PostPosted: Fri Aug 17, 2012 10:08 am
Reply with quote

Hi,

here is a solution as has been suggested
Code:
//STEP0100 EXEC PGM=SORT                                           
//SYSOUT   DD SYSOUT=*                                             
//SORTIN   DD *                                                   
ABCDEFG.TXT                                                       
CD AAAAAA                                                         
CD BBBBBB                                                         
CD CCCCCCC                                                         
CD DDDDDDD                                                         
LOCSITE PRI=5 CY SEC=1 CY U=TESTDA REC=FB LR=1402 BLOCKSI=0       
GET                                                   +           
USER.NONX.USER9999.SAMPLE(+1)'                                     
QUIT                                                               
//SORTOUT  DD SYSOUT=*                                             
//SYSIN    DD *                                                   
  OPTION COPY                                                     
  INREC IFTHEN=(WHEN=INIT,OVERLAY=(81:SEQNUM,4,ZD)),               
  IFTHEN=(WHEN=GROUP,BEGIN=(81,4,ZD,EQ,+1),PUSH=(85:1,32))         
  OUTREC IFTHEN=(WHEN=(1,4,CH,EQ,C'GET '),                         
        OVERLAY=(5:85,32))                                         
  OUTFIL OMIT(81,4,ZD,EQ,+1),BUILD=(1,80)                         


Gerry
Back to top
View user's profile Send private message
mksranjani

New User


Joined: 03 Feb 2010
Posts: 29
Location: Chennai

PostPosted: Fri Aug 17, 2012 10:45 am
Reply with quote

Gerry,

I tried the code you provided. Got the output as below. The data in first line is removed but it is not moved near 'get'.
Code:
cd aaaaaa                                                   
cd bbbbbb                                                   
cd ccccccc                                                   
cd ddddddd                                                   
locsite pri=5 cy sec=1 cy u=testda rec=fb lr=1402 blocksi=0 
get                                                       +     
USER.NONX.USER9999.SAMPLE(+1)'                               
quit                             
Back to top
View user's profile Send private message
gcicchet

Senior Member


Joined: 28 Jul 2006
Posts: 1702
Location: Australia

PostPosted: Fri Aug 17, 2012 10:58 am
Reply with quote

Hi,

my get is in upper case, try changing it to lower case.


Gerry
Back to top
View user's profile Send private message
mksranjani

New User


Joined: 03 Feb 2010
Posts: 29
Location: Chennai

PostPosted: Fri Aug 17, 2012 11:18 am
Reply with quote

Gerry,

I changed it to lower case, and I got the expected result.
Great and thanks a lot!
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 Goto page 1, 2  Next

 


Similar Topics
Topic Forum Replies
No new posts How to split large record length file... DFSORT/ICETOOL 9
No new posts Extracting Variable decimal numbers f... DFSORT/ICETOOL 17
No new posts SFTP Issue - destination file record ... All Other Mainframe Topics 2
No new posts Access to non cataloged VSAM file JCL & VSAM 18
No new posts Need help for File Aid JCL to extract... Compuware & Other Tools 23
Search our Forums:

Back to Top