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
 

 

Need help on DFSORT

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

New User


Joined: 22 Dec 2007
Posts: 73
Location: Bangalore

PostPosted: Tue Feb 24, 2015 2:13 pm    Post subject: Need help on DFSORT
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

DFSORT Moderator


Joined: 09 Mar 2011
Posts: 7225

PostPosted: Tue Feb 24, 2015 2:24 pm    Post subject: Reply to: Need help on DFSORT
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

New User


Joined: 22 Dec 2007
Posts: 73
Location: Bangalore

PostPosted: Tue Feb 24, 2015 2:28 pm    Post subject:
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

New User


Joined: 22 Dec 2007
Posts: 73
Location: Bangalore

PostPosted: Tue Feb 24, 2015 5:08 pm    Post subject:
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

DFSORT Moderator


Joined: 09 Mar 2011
Posts: 7225

PostPosted: Tue Feb 24, 2015 5:54 pm    Post subject: Reply to: Need help on DFSORT
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

New User


Joined: 22 Dec 2007
Posts: 73
Location: Bangalore

PostPosted: Tue Feb 24, 2015 6:52 pm    Post subject:
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

New User


Joined: 22 Dec 2007
Posts: 73
Location: Bangalore

PostPosted: Wed Feb 25, 2015 9:20 am    Post subject:
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    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 get the remainder and quotient... vnktrrd DFSORT/ICETOOL 2 Mon Oct 31, 2016 10:59 am
No new posts Change date (DD/MM/YY) in 2nd record ... uday kiran DFSORT/ICETOOL 12 Wed Sep 07, 2016 10:57 pm
No new posts DFSORT sorting only specific records akodakka DFSORT/ICETOOL 4 Thu Aug 04, 2016 11:24 am
No new posts Symbolic Parameters in SYSIN DD state... madishpa DFSORT/ICETOOL 3 Mon Jun 27, 2016 6:23 pm
No new posts DFSORT to match two files and write John F Dutcher DFSORT/ICETOOL 6 Thu May 12, 2016 5:17 pm


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