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

Need help on DFSORT


IBM Mainframe Forums -> DFSORT/ICETOOL
Post new topic   Reply to topic
View previous topic :: View next topic  
Author Message
subratarec

Active User


Joined: 22 Dec 2007
Posts: 126
Location: Bangalore

PostPosted: Tue Feb 24, 2015 2:13 pm
Reply with quote

Hi,

I know this topic has already been discussed couple of times. But I am not able to find correct solution related my issue. Can anyone please assist me (if any hints or point me to the old same topic)?

Issue desc:
-------------------------------------------------
INCLUDE file of output structure:

Code:
OUT_ID_MODEL                  CHAR  (05),         
OUT_FILLER1                   CHAR  (01) INIT(';'),
OUT_ID_COLOUR                 CHAR  (01),         
OUT_FILLER2                   CHAR  (01) INIT(';'),
OUT_ID_SIZE                   CHAR  (03),         
OUT_FILLER3                   CHAR  (01) INIT(';'),
OUT_ID_WEIGHT                 FIXED (05),         
OUT_FILLER4                   CHAR  (01) INIT(';'),
OUT_ID_LENGTH                 FIXED (03),         
OUT_FILLER5                   CHAR  (01) INIT(';'),
OUT_ID_WIDTH                  FIXED (03),         
OUT_FILLER6                   CHAR  (01) INIT(';'),
OUT_ID_HEIGHT                 FIXED (03),         
OUT_FILLER7                   CHAR  (01) INIT(';'),
OUT_ID_CARTON_SIZE            CHAR  (03),         
OUT_FILLER8                   CHAR  (47) INIT('');


Need to copy the output file to another sequential file (all the records) and convert to Zoned Decimal from these 4 Fixed Decimal as well.

I know that I have to use OUTREC FIELDS with PD,TO=ZD but when I mentioning this with column details (like for the first fixed dec 13,3) it is copying only those columns but I want to copy all the recs with converted data

Thanks in advance
Subrata
Back to top
View user's profile Send private message
Bill Woodger

Moderator Emeritus


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

PostPosted: Tue Feb 24, 2015 2:24 pm
Reply with quote

Look at this.

OK, that's just so you don't in the future suggest using FIELDS without paying up.

You'll want INREC (unless other indications) BUILD=(1,lengthh-up-to-packed-fields,your-existing-conversion-stuff,byte-after-packed-fields,remaining-length).

If your records are variable-length, you remove ",remaining-length".
Back to top
View user's profile Send private message
subratarec

Active User


Joined: 22 Dec 2007
Posts: 126
Location: Bangalore

PostPosted: Tue Feb 24, 2015 2:28 pm
Reply with quote

Hi Bill,

Thanks!! for the details. I am going through now. If I face any difficulty in understanding any points, I will get back to you.

Thanks
Subrata
Back to top
View user's profile Send private message
subratarec

Active User


Joined: 22 Dec 2007
Posts: 126
Location: Bangalore

PostPosted: Tue Feb 24, 2015 5:08 pm
Reply with quote

Hi Bill,

I used below code and got my job done. This code may not be the best but for time being it serves my need. But if you have any suggestion please let me have that so I can do better in future. Thanks Bill!!

Code:
//SORT     EXEC PGM=SORT                               
//SORTIN   DD  DSN=HXXX.Q.HXXXX.OUTFILE.G0001V00,     
//             DISP=SHR                                 
//SORTOUT  DD  DSN=HXXXXX.FILEM.PRINT.OUTPUT,         
//             DISP=(NEW,CATLG,DELETE),                 
//             LIKE=HXXXX.Q.HXXXXX.OUTFILE.G0001V00     
//SYSOUT   DD  SYSOUT=*                                 
//SYSIN    DD  *                                       
  OPTION COPY                                           
  INREC BUILD=(1,12,13,3,PD,TO=ZD,LENGTH=3,16,1,17,2,PD,TO=ZD,LENGTH=2,
             19,1,20,2,PD,TO=ZD,LENGTH=2,22,1,                       
             23,2,PD,TO=ZD,LENGTH=2,25,1,26,49)                 
Back to top
View user's profile Send private message
Bill Woodger

Moderator Emeritus


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

PostPosted: Tue Feb 24, 2015 5:54 pm
Reply with quote

It is a curious coincidence if you need to truncate all of the packed-decimal values. A 3-byte PD can contain five digits: you use length of three.

If you do need to change that, you're going to have a small problem because the LIKE in the JCL is going to give you an LRECL, whereas the record you create will be longer than the record it came from.

It is always better, with SORT, not to specify the LRECL in the JCL for the output file, as you will then have two places to change it (the SORT cards and the JCL) rather than just let SORT supply it (which it will do if not specified).

You can always make life easier for yourself (and others) by making it easier to read and change:

Code:

  INREC BUILD=(1,12,
               13,3,PD,TO=ZD,LENGTH=3,
               16,1,
               17,2,PD,TO=ZD,LENGTH=2,
               19,1,
               20,2,PD,TO=ZD,LENGTH=2,
               22,1,                       
               23,2,PD,TO=ZD,LENGTH=2,
               25,1,
               26,49)


So now easy to see that the 25,1 and 26.49 can go together, 25,50.

If you want to make things even clearer there are symbols/SYMNAMES which allow you to give names to everything.
Back to top
View user's profile Send private message
subratarec

Active User


Joined: 22 Dec 2007
Posts: 126
Location: Bangalore

PostPosted: Tue Feb 24, 2015 6:52 pm
Reply with quote

Hi Bill.

You are right. I need revisit the SORT. Thanks a miliion for your suggestion. Let me correct those point sin my JCL.

Thanks
Subrata
Back to top
View user's profile Send private message
subratarec

Active User


Joined: 22 Dec 2007
Posts: 126
Location: Bangalore

PostPosted: Wed Feb 25, 2015 9:20 am
Reply with quote

Corrected the JCL. Thanks Bill. for pointing me out my mistake. Hope to get more valuable suggestions from your end.

Thanks
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 -> DFSORT/ICETOOL

 


Similar Topics
Topic Forum Replies
No new posts Modifying Date Format Using DFSORT DFSORT/ICETOOL 9
No new posts Replace Multiple Field values to Othe... DFSORT/ICETOOL 12
No new posts Calling DFSORT from Cobol, using OUTF... DFSORT/ICETOOL 5
No new posts DFsort help with SUM() DFSORT/ICETOOL 12
No new posts DFSORT - VB file RDW getting overridden DFSORT/ICETOOL 3
Search our Forums:

Back to Top