Portal | Manuals | References | Downloads | Info | Programs | JCLs | Mainframe wiki | Quick Ref

Author Message
Keanehelp

New User

Joined: 27 May 2008
Posts: 71
Location: USA, CA.

 Posted: Wed Apr 04, 2012 8:24 pm    Post subject: Help with Sort Hi, We have to convert a flate sequential file into a report and we are using SORT utility for this like.. Input: - 111222222|111 222222|666666666|XXXX|CHUNG |000000000016.00|0000250007.88 Sort Card used -- 001X,1/01:'ACCT# ',1X,'|',1X,'OFF-ACCT ',1X,'|',1X, HEADER 'CUSIP ',1X,'|',1X,'SYMBOL',1X,'|',1X, 'SHORT-NAME ',1X,'|',1X,'DEBIT AMOUNT ',1X,'|',1X, 'MM BALANCE ', 001X,1/01:'---------------------------------------------', 46:'---------------------------------------------'), OUTREC=(1:1,9,10:C' | ',13:11,10,23:C' | ',26:22,9,35:C' | ', 38:32,4,42:C' | ',47:37,11,58:C' | ', 61:49,15,76:C' | ',79:65,12,42X), TRAILER1=(10:'TOTAL NO OF ACCOUNTS: ',1X,COUNT) The final output is like - ----------------------------------------------------------------------- ACCT# | OFF-ACCT | CUSIP | SYMBOL | SHORT-NAME | DEBIT AMOUNT | MM BALANCE ----------------------------------------------------------------------- 111222222 | 111 222222 | 666666666 | XXXX | CHUNG | 000000000016.00 | 000025007.88 The question is --> We want that leading zeroes should be supressed in the amount field and amount field should also appear in nnn,nnn,nnn.nn format. Please suggest

Active User

Joined: 20 Sep 2006
Posts: 154
Location: US

Posted: Wed Apr 04, 2012 8:44 pm    Post subject:

try below mentioned Sort Card

 Code: //STEP002  EXEC PGM=SORT                                                //*                                                                      //SORTIN DD  *                                                          111222222|111 222222|666666666|XXXX|CHUNG |000000001016.00|0000250007.88 /*                                                                      //SYSOUT   DD SYSOUT=*                                                  //SORTOUT  DD SYSOUT=*                                                  //*                                                                      //SYSIN DD *                                                              SORT FIELDS=COPY                                                        OUTFIL FNAMES=SORTOUT,REMOVECC,                                          HEADER1=(1:C'ACCT# ',1X,'|',1X,C'OFF-ACCT ',1X,'|',1X,                             C'CUSIP ',1X,'|',1X,C'SYMBOL',1X,'|',1X,                                 C'SHORT-NAME ',1X,'|',1X,C'DEBIT AMOUNT ',1X,'|',1X,                     C'MM BALANCE ',/,                                                     1:C'---------------------------------------------',                    46:C'---------------------------------------------'),            OUTREC=(1:1,9,10:C' | ',13:11,10,23:C' | ',26:22,9,35:C' | ',    38:32,4,42:C' | ',45:37,06,51:C' | ',                            54:44,15,UFF,EDIT=(III,III,III,IIT.TT),72:C' | ',75:60,13,42X),   TRAILER1=(10:'TOTAL NO OF ACCOUNTS: ',1X,COUNT)                /*

Output:

 Code: ACCT#  | OFF-ACCT  | CUSIP  | SYMBOL | SHORT-NAME  | DEBIT AMOUNT  | MM BALANCE ------------------------------------------------------------------------------------------- 111222222 | 111 222222 | 666666666 | XXXX | CHUNG  |           1,016.00 | 0000250007.88          TOTAL NO OF ACCOUNTS:         1
Keanehelp

New User

Joined: 27 May 2008
Posts: 71
Location: USA, CA.

 Posted: Thu Apr 05, 2012 7:33 pm    Post subject: It worked...Thanks
Marso

REXX Moderator

Joined: 13 Mar 2006
Posts: 1275
Location: Israel

Posted: Thu Apr 05, 2012 8:05 pm    Post subject:

 Code: 1X,'|',1X

 Code: C' | '

Is there any reason why you use both formats ?
Are you aware that 1X generates a low-value and not a space ?
Skolusu

Senior Member

Joined: 07 Dec 2007
Posts: 2205
Location: San Jose

Posted: Thu Apr 05, 2012 10:21 pm    Post subject:

 Marso wrote: Are you aware that 1X generates a low-value and not a space ?

Marso,

Where did you get that information? X denotes a space for DFSORT and Z denotes a binary zero X'00'. we would like to see where specifying X is generating a value other than space.
Marso

REXX Moderator

Joined: 13 Mar 2006
Posts: 1275
Location: Israel

 Posted: Wed Apr 11, 2012 3:22 pm    Post subject: Sorry, I received LV a few times in some output files, and I always thought it was because I used X instead of C. Apparently there was another reason (and of course I wasn't able to recreate the case).
Skolusu

Senior Member

Joined: 07 Dec 2007
Posts: 2205
Location: San Jose

Posted: Wed Apr 11, 2012 11:30 pm    Post subject:

 Marso wrote: Sorry, I received LV a few times in some output files, and I always thought it was because I used X instead of C. Apparently there was another reason (and of course I wasn't able to recreate the case).

Marso,

You might have got a low-value (binary zeroes) when the SORTOUT LRECL is greater than SORTIN LRECL. Read this about padding and truncation

http://publibz.boulder.ibm.com/cgi-bin/bookmgr_OS390/BOOKS/ice1ca60/1.8.3.2
 All times are GMT + 6 Hours
 Page 1 of 1

Search our Forum:

 Topic Author Forum Replies Posted Similar Topics Sort numeric fields with trailing spaces sancraig16 SYNCSORT 7 Tue Apr 03, 2018 1:21 am Find & Replace string in CA-SORT mrgnndhmk CA Products 1 Fri Mar 30, 2018 12:58 am SORT 3 files,extract specific fields ... Kiransr DFSORT/ICETOOL 13 Fri Mar 23, 2018 10:54 am How to Generate JCL using Sort naveen katkuri DFSORT/ICETOOL 7 Tue Mar 13, 2018 3:50 pm Need better approach to create a sort... Vamshi Veludandi DFSORT/ICETOOL 8 Thu Mar 08, 2018 5:59 pm

 © 2003-2017 IBM MAINFRAME Software Support Division
 Job Vacancies | Forum Rules | Bookmarks | Subscriptions | FAQ | Polls | Contact Us