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
 

 

Sort from input VB format to output VB format

 
Post new topic   Reply to topic    IBMMAINFRAMES.com Support Forums -> DFSORT/ICETOOL
View previous topic :: :: View next topic  
Author Message
bhaskar_kanteti

Active User


Joined: 01 Feb 2007
Posts: 120
Location: USA

PostPosted: Fri Nov 16, 2007 6:09 pm    Post subject: Sort from input VB format to output VB format
Reply with quote

Hi,

Here is the code.
Code:

//STEP010  EXEC PGM=ICETOOL                                       
//TOOLMSG  DD SYSOUT=*                                           
//DFSMSG   DD SYSOUT=*                                           
//SYSOUT   DD SYSOUT=*                                           
//SYSUDUMP DD SYSOUT=C                                           
//SYSPRINT DD SYSOUT=*                                           
//INPUTX   DD DSN=MY.INPUT1,DISP=SHR       
//              DD DSN=MY.INPUT2,DISP=SHR       
//              DD DSN=MY.INPUT3,DISP=SHR   
//TEMP     DD DSN=&&TEMP1,DISP=(MOD,PASS),                       
//             SPACE=(CYL,(100,500)),RECFM=VB,                   
//             UNIT=SYSDA                                         
//OUTPUT  DD DSN=MY.OUTPUT,         
//             DISP=(,CATLG,DELETE),DATACLAS=DSIZC100,           
//             RECFM=VB,LRECL=32756                               
//TOOLIN   DD *                                                   
 COPY FROM(INPUTX) TO(TEMP) USING(CNT1)                           
 COPY FROM(TEMP) TO(OUTPUT) USING(CNT2)                           
/*                                                               
//CNT1CNTL DD *                                                   
 INCLUDE COND=((5,2,CH,NE,X'0000',AND,5,2,CH,NE,X'FFFF'))         
/*                                                               
//CNT2CNTL DD *                                                   
 SORT FIELDS=(5,2,CH,A,7,20,CH,A,27,20,CH,A,114,1,CH,A,47,3,CH,A,
              50,4,CH,A,54,20,CH,A,74,20,CH,A)                   
 OUTFIL FNAMES=OUTPUT,REMOVECC,                                   
     HEADER1=(5:X'0000',                                         
              DATENS=(DM4)),                                     
     TRAILER1=(5:X'FFFF',                                         
              COUNT=(M11,LENGTH=08)),                             
     OUTREC=(5:5,32752)                                           
/*                                                               



In the above code my input files are of VB format and RECL length is 32756. Even my output is of same VB format and RECl length is 32756.
All the 3 input files have header and trailer. So first i am removing the header and trailer from the input files and copying the date records to temp.
And later from temp to output file by creating header and trailer.
But it is throwing error as below.
Code:

- CONTROL STATEMENTS FOR 5694-A01, Z/OS DFSORT V1R5 - 12:28 ON FRI NOV
 SORT FIELDS=(5,2,CH,A,7,20,CH,A,27,20,CH,A,114,1,CH,A,47,3,CH,A,     
              50,4,CH,A,54,20,CH,A,74,20,CH,A)                       
 OUTFIL FNAMES=OUTPUT,REMOVECC,                                       
     HEADER1=(5:X'0000',                                             
              DATENS=(DM4)),                                         
     TRAILER1=(5:X'FFFF',                                             
              COUNT=(M11,LENGTH=08)),                                 
     OUTREC=(5:5,32752)                                               
                 £                                                   
REFORMATTING FIELD ERROR                                             
END OF STATEMENTS FROM CNT2CNTL - PARAMETER LIST STATEMENTS FOLLOW   
DEBUG NOABEND,ESTAE                                                   
OPTION MSGDDN=DFSMSG,LIST,MSGPRT=ALL,RESINV=0,SORTDD=CNT2,SORTIN=TEMP,
               ORTOUT=OUTPUT,DYNALLOC                                 
SORT FIELDS=COPY                                                     
C5-K90007 C6-K90007 C7-K90000 C8-K90007 E7-K11698                     
END OF DFSORT                                                         
Back to top
View user's profile Send private message

Frank Yaeger

DFSORT Moderator


Joined: 15 Feb 2005
Posts: 7130
Location: San Jose, CA

PostPosted: Fri Nov 16, 2007 9:55 pm    Post subject:
Reply with quote

Your OUTREC operand is invalid because it doesn't contain the RDW and specifies an input field that's beyond the end of the input file.

Since you're just copying the entire input record, you don't need the OUTREC operand. Note that you also don't need a separate COPY operator for the INCLUDE statement.

You can use this DFSORT/ICETOOL job:

Code:

//STEP010  EXEC PGM=ICETOOL
//TOOLMSG  DD SYSOUT=*
//DFSMSG   DD SYSOUT=*
//SYSUDUMP DD SYSOUT=C
//INPUTX   DD DSN=MY.INPUT1,DISP=SHR
//              DD DSN=MY.INPUT2,DISP=SHR
//              DD DSN=MY.INPUT3,DISP=SHR
//OUTPUT  DD DSN=MY.OUTPUT,
//             DISP=(,CATLG,DELETE),DATACLAS=DSIZC100
//TOOLIN   DD *
COPY FROM(INPUTX) TO(OUTPUT) USING(CNT1)
/*
//CNT1CNTL DD *
 INCLUDE COND=((5,2,CH,NE,X'0000',AND,5,2,CH,NE,X'FFFF'))
 SORT FIELDS=(5,2,CH,A,7,20,CH,A,27,20,CH,A,114,1,CH,A,47,3,CH,A,
              50,4,CH,A,54,20,CH,A,74,20,CH,A)
 OUTFIL FNAMES=OUTPUT,REMOVECC,
     HEADER1=(5:X'0000',
              DATENS=(DM4)),
     TRAILER1=(5:X'FFFF',
              COUNT=(M11,LENGTH=08))
/*
Back to top
View user's profile Send private message
bhaskar_kanteti

Active User


Joined: 01 Feb 2007
Posts: 120
Location: USA

PostPosted: Sat Nov 17, 2007 6:43 pm    Post subject: Reply to: Sort from input VB format to output VB format
Reply with quote

Hi Frank,

Thanks for explaining and providing the soluition.
Its working. Thank you so much.
Back to top
View user's profile Send private message
Frank Yaeger

DFSORT Moderator


Joined: 15 Feb 2005
Posts: 7130
Location: San Jose, CA

PostPosted: Sun Nov 18, 2007 10:09 pm    Post subject:
Reply with quote

Glad I could help.
Back to top
View user's profile Send private message
bhaskar_kanteti

Active User


Joined: 01 Feb 2007
Posts: 120
Location: USA

PostPosted: Mon Nov 19, 2007 3:53 pm    Post subject: Reply to: Sort from input VB format to output VB format
Reply with quote

Hi,

For the above reqirement i am using DFSORT. The code is as below:

Code:

//STEP010  EXEC PGM=SORT                                           
//TOOLMSG  DD SYSOUT=*                                             
//DFSMSG   DD SYSOUT=*                                             
//SYSOUT   DD SYSOUT=*                                             
//SYSUDUMP DD SYSOUT=C                                             
//SYSPRINT DD SYSOUT=*                                             
//SORTIN1  DD DSN=MY.INPUT1,DISP=SHR         
//               DD DSN=MY.INPUT2,DISP=SHR         
//               DD DSN=MY.INPUT3,DISP=SHR   
//SORTOUT  DD DSN=MY.OUTPUT,         
//             DISP=(,CATLG,DELETE),DATACLAS=DSIZC100,             
//             RECFM=VB,LRECL=32756                               
//SYSIN    DD *                                                   
 OMIT COND=(5,2,CH,EQ,X'0000',OR,5,2,CH,EQ,X'FFFF')               
 SORT FIELDS=(5,2,CH,A,7,20,CH,A,27,20,CH,A,114,1,CH,A,47,3,CH,A, 
              50,4,CH,A,54,20,CH,A,74,20,CH,A)                     
 OUTFIL REMOVECC,                                                 
     HEADER1=(5:X'0000',DATENS=(DM4)),                             
     TRAILER1=(5:X'FFFF',                                         
              COUNT=(M11,LENGTH=08))                               
/*                                                                 


The code is working fine.
For all the 3 input files i had header and trailer.
While i am creating header in my putput file i am taking the current date. But i need the entire header of the first input file.
how can i take the entire header of my first input file and and populate as the header of my output file.
Back to top
View user's profile Send private message
krisprems

Active Member


Joined: 27 Nov 2006
Posts: 649
Location: India

PostPosted: Mon Nov 19, 2007 5:19 pm    Post subject:
Reply with quote

bhaskar_kanteti
Here is the SORT jCL for your requirement
Code:
//*******************************************************               
//STEP1    EXEC PGM=SORT                                               
//SYSOUT   DD SYSOUT=*                                                 
//SORTIN   DD DSN=i/p-1,DISP=SHR                               
//         DD DSN=i/p-2,DISP=SHR                               
//         DD DSN=i/p-3,DISP=SHR                               
//SYM      DD DSN=&&TEMP1,DISP=(MOD,PASS),SPACE=(TRK,(5,5)),UNIT=SYSDA 
//DETAIL   DD DSN=&&TEMP2,DISP=(MOD,PASS),SPACE=(TRK,(5,5)),UNIT=SYSDA 
//SYSIN    DD *                                                         
  SORT FIELDS=COPY                                                     
  OMIT COND=(5,2,CH,EQ,X'FFFF')                                         
  INREC IFTHEN=(WHEN=(5,2,CH,EQ,X'0000'),OVERLAY=(LRECL:SEQNUM,8,ZD))   
  OUTFIL FNAMES=SYM,INCLUDE=(LRECL,8,ZD,EQ,1),VTOF,                     
         BUILD=(C'HDRDATE,C''',7,10,C'''',80:X)                         
  OUTFIL FNAMES=DETAIL,INCLUDE=(5,2,CH,NE,X'0000'),REMOVECC             
/*                                                                     
//*******************************************************               
//STEP2    EXEC PGM=SORT                                               
//SYSOUT   DD SYSOUT=*                                                 
//SYMNAMES DD DSN=&&TEMP1,DISP=(MOD,PASS)                               
//SORTIN   DD DSN=&&TEMP2,DISP=(MOD,PASS)                               
//SORTOUT  DD SYSOUT=*                                                 
//SYSIN    DD *                                                         
  SORT FIELDS=(5,2,CH,A,7,20,CH,A,27,20,CH,A,114,1,CH,A,47,3,CH,A,     
                50,4,CH,A,54,20,CH,A,74,20,CH,A)                       
  OUTFIL HEADER1=(5:X'0000',HDRDATE),
 TRAILER1=(5:X'FFFF',COUNT=(M11,LENGTH=08))                                           
/*                                                                     



Note: In STEP1 where ever i have mentioned as LRECL replace it with the LRECL of the i/p file
Back to top
View user's profile Send private message
Frank Yaeger

DFSORT Moderator


Joined: 15 Feb 2005
Posts: 7130
Location: San Jose, CA

PostPosted: Mon Nov 19, 2007 10:56 pm    Post subject:
Reply with quote

Bhaskar,

Here's a DFSORT job that will keep the header record from the first input file and remove the header records from the other input files:

Code:

//STEP010  EXEC PGM=SORT
//SYSOUT  DD SYSOUT=*
//SORTIN  DD DSN=MY.INPUT1,DISP=SHR
//        DD DSN=MY.INPUT2,DISP=SHR
//        DD DSN=MY.INPUT3,DISP=SHR
//OUTPUT  DD DSN=MY.OUTPUT,
//             DISP=(,CATLG,DELETE),DATACLAS=DSIZC100,
//             RECFM=VB,LRECL=32756
//SYSIN DD *
  OMIT COND=(5,2,CH,EQ,X'FFFF')
  SORT FIELDS=(5,2,CH,A,7,20,CH,A,27,20,CH,A,114,1,CH,A,47,3,CH,A,
               50,4,CH,A,54,20,CH,A,74,20,CH,A)
  OUTREC BUILD=(1,4,5:SEQNUM,1,ZD,6:5)
  OUTFIL FNAMES=OUTPUT,REMOVECC,
      OMIT=(6,2,BI,EQ,X'0000',AND,5,1,ZD,GT,+1),
      BUILD=(1,4,5:6),
      TRAILER1=(5:X'FFFF',COUNT-1=(M11,LENGTH=08))
/*
Back to top
View user's profile Send private message
bhaskar_kanteti

Active User


Joined: 01 Feb 2007
Posts: 120
Location: USA

PostPosted: Tue Nov 20, 2007 10:29 am    Post subject: Reply to: Sort from input VB format to output VB format
Reply with quote

Hi Frank,

When i am trying the run tha above SORT it is abending. And the error is as follows.

Code:

  OMIT COND=(5,2,CH,EQ,X'FFFF')                                          00170
  SORT FIELDS=(5,2,CH,A,7,20,CH,A,27,20,CH,A,114,1,CH,A,47,3,CH,A,       00180
               50,4,CH,A,54,20,CH,A,74,20,CH,A)                          00190
  OUTREC BUILD=(1,4,5:SEQNUM,1,ZD,6:5)                                   00200
  OUTFIL FNAMES=OUTPUT,REMOVECC,                                        00210
      OMIT=(6,2,BI,EQ,X'0000',AND,5,1,ZD,GT,+1),                         00220
      BUILD=(1,4,5:6),                                                   00230
      TRAILER1=(5:X'FFFF',                                               00240
               COUNT-1=(M11,LENGTH=08))                                  00250
 RECORD TYPE IS V - DATA STARTS IN POSITION 5                                 
 VLSHRT NOT USED FOR SORT, MERGE, INCLUDE, OMIT OR SUM STATEMENT FIELDS       
 TTOI36N .STEP010 .        , INPUT LRECL = 32756, BLKSIZE = 32760, TYPE = VB 
 OPTIONS: NULLOUT=RC0                                                         
 EXCP ACCESS METHOD USED FOR SORTIN                                           
 14 BYTE VARIABLE RECORD IS SHORTER THAN 114 BYTE MINIMUM FOR          FIELDS
 END OF DFSORT                                                               


Can you tell me what the error is.
Back to top
View user's profile Send private message
Frank Yaeger

DFSORT Moderator


Joined: 15 Feb 2005
Posts: 7130
Location: San Jose, CA

PostPosted: Tue Nov 20, 2007 9:20 pm    Post subject:
Reply with quote

As the error message indicates, you have records that do not have all of your sort fields. You're trying to sort on position 114, but you have a record that's only 14 bytes long. VLSHRT would normally take care of this, but it can't be used with the OUTREC statement. So you'll need to use two passes with a DFSORT/ICETOOL job like this:

Code:

//STEP010  EXEC PGM=ICETOOL
//TOOLMSG DD SYSOUT=*
//DFSMSG  DD SYSOUT=*
//IN  DD DSN=MY.INPUT1,DISP=SHR
//        DD DSN=MY.INPUT2,DISP=SHR
//        DD DSN=MY.INPUT3,DISP=SHR
//T1 DD DSN=&&T1,UNIT=SYSDA,SPACE=(CYL,(5,5)),DISP=(,PASS)
//OUTPUT  DD DSN=MY.OUTPUT,
//             DISP=(,CATLG,DELETE),DATACLAS=DSIZC100,
//             RECFM=VB,LRECL=32756
//TOOLIN DD *
SORT FROM(IN) TO(T1) USING(CTL1)
COPY FROM(T1) USING(CTL2)
/*
//CTL1CNTL DD *
  OPTION VLSHRT
  OMIT COND=(5,2,CH,EQ,X'FFFF')
  SORT FIELDS=(5,2,CH,A,7,20,CH,A,27,20,CH,A,114,1,CH,A,47,3,CH,A,
               50,4,CH,A,54,20,CH,A,74,20,CH,A)
/*
//CTL2CNTL DD *
  OUTREC BUILD=(1,4,5:SEQNUM,1,ZD,6:5)
  OUTFIL FNAMES=OUTPUT,REMOVECC,
      OMIT=(6,2,BI,EQ,X'0000',AND,5,1,ZD,GT,+1),
      BUILD=(1,4,5:6),
      TRAILER1=(5:X'FFFF',
               COUNT-1=(M11,LENGTH=08))
/*
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 -> DFSORT/ICETOOL 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 Replace values in the input data Vikas Maharnawar DFSORT/ICETOOL 10 Thu May 11, 2017 2:18 pm
No new posts find RACF group for access to spooled... jzhardy JCL & VSAM 1 Mon May 08, 2017 11:46 am
No new posts Adding big TEXT lines to each record ... bshkris SYNCSORT 4 Sat May 06, 2017 1:40 am
This topic is locked: you cannot edit posts or make replies. SORT trick needed bshkris SYNCSORT 6 Tue May 02, 2017 4:35 am


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