Change negative ZD to unsigned.



IBM's flagship sort product DFSORT for sorting, merging, copying, data manipulation and reporting. Includes ICETOOL and ICEGENER

Change negative ZD to unsigned.

Postby schneiderusa » Wed Mar 24, 2010 12:07 am

Hello,

Is it possible to change negative ZD to positive ZD or unsigned in SORT?

For example before sort some number are negative "-1000.00" PIC S9(15)V99.
and after sort I need them to be unsigned "1000.00" PIC 9(15)V99.

Thank you.
schneiderusa
 
Posts: 11
Joined: Tue Mar 23, 2010 11:47 pm
Has thanked: 0 time
Been thanked: 0 time

Re: Change negative ZD to unsigned.

 

Re: Change negative ZD to unsigned.

Postby Frank Yaeger » Wed Mar 24, 2010 12:31 am

PIC S9(15)V99 would be a 17-byte ZD value.

You can use DFSORT control statements like this. For the example, I assumed your 17 byte ZD value starts in position 11. Adjust appropriately.

    OPTION COPY
    INREC IFTHEN=(WHEN=(11,17,ZD,LT,0),
       OVERLAY=(11:11,17,ZD,MUL,-1,TO=ZDC,LENGTH=17))


If you want an F for the positive sign instead of a C, use TO=ZDF instead of TO=ZDC.
Frank Yaeger - DFSORT Development Team (IBM) - yaeger@us.ibm.com
Specialties: JOINKEYS, FINDREP, WHEN=GROUP, ICETOOL, Symbols, Migration
=> DFSORT/MVS is on the Web at http://www.ibm.com/storage/dfsort
User avatar
Frank Yaeger
Global moderator
 
Posts: 1080
Joined: Sat Jun 09, 2007 8:44 pm
Has thanked: 0 time
Been thanked: 14 times

Re: Change negative ZD to unsigned.

Postby schneiderusa » Wed Mar 24, 2010 12:59 am

Thank you Frank,

This my SORT. I actually have two fields that needs to be unsigned. First I add amounts and then I need to show them unsigned.
Did I code this correctly?

//SYSIN DD *
SORT FIELDS=(9,8,CH,A,22,12,CH,A,42,11,CH,A,484,2,CH,A)
SUM FIELDS=(55,17,ZD,73,15,ZD)
INREC IFTHEN=(WHEN=(55,17,ZD,LT,0),
OVERLAY=(55:55,17,ZD,MUL,-1,TO=ZDC,LENGTH=17))
INREC IFTHEN=(WHEN=(73,15,ZD,LT,0),
OVERLAY=(73:73,15,ZD,MUL,-1,TO=ZDC,LENGTH=15))

//SYSOUT DD SYSOUT=*
schneiderusa
 
Posts: 11
Joined: Tue Mar 23, 2010 11:47 pm
Has thanked: 0 time
Been thanked: 0 time

Re: Change negative ZD to unsigned.

Postby schneiderusa » Wed Mar 24, 2010 1:20 am

Hi Frank,
It works for one field, how do I add second "IFTHEN" condition?

//SYSIN DD *
SORT FIELDS=(9,8,CH,A,22,12,CH,A,42,11,CH,A,484,2,CH,A)
SUM FIELDS=(55,17,ZD,73,15,ZD)
OUTREC IFTHEN=(WHEN=(73,15,ZD,LT,0),
OVERLAY=(73:73,15,ZD,MUL,-1,TO=ZDF,LENGTH=15))
IFTHEN=(WHEN=(55,17,ZD,LT,0),
OVERLAY=(55:55,17,ZD,MUL,-1,TO=ZDC,LENGTH=17))
//SYSOUT DD SYSOUT=*

Thanks,
Gary.
schneiderusa
 
Posts: 11
Joined: Tue Mar 23, 2010 11:47 pm
Has thanked: 0 time
Been thanked: 0 time

Re: Change negative ZD to unsigned.

Postby schneiderusa » Wed Mar 24, 2010 1:34 am

I got it, just forgot to put comma. Thank you. Nice forum :D

//SYSIN DD *
SORT FIELDS=(9,8,CH,A,22,12,CH,A,42,11,CH,A,484,2,CH,A)
SUM FIELDS=(55,17,ZD,73,15,ZD)
OUTREC IFTHEN=(WHEN=(73,15,ZD,LT,0),
OVERLAY=(73:73,15,ZD,MUL,-1,TO=ZDF,LENGTH=15)),
IFTHEN=(WHEN=(55,17,ZD,LT,0),
OVERLAY=(55:55,17,ZD,MUL,-1,TO=ZDF,LENGTH=17))
//SYSOUT DD SYSOUT=*
schneiderusa
 
Posts: 11
Joined: Tue Mar 23, 2010 11:47 pm
Has thanked: 0 time
Been thanked: 0 time

Re: Change negative ZD to unsigned.

Postby Frank Yaeger » Wed Mar 24, 2010 2:48 am

I got it, just forgot to put comma. Thank you. Nice forum


Actually, you should use HIT=NEXT for the first IFTHEN clause to make sure you get to the second one since they involve two different fields.

//SYSIN DD *
   SORT FIELDS=(9,8,CH,A,22,12,CH,A,42,11,CH,A,484,2,CH,A)
  SUM FIELDS=(55,17,ZD,73,15,ZD)
  OUTREC IFTHEN=(WHEN=(73,15,ZD,LT,0),
    OVERLAY=(73:73,15,ZD,MUL,-1,TO=ZDF,LENGTH=15),HIT=NEXT),
   IFTHEN=(WHEN=(55,17,ZD,LT,0),
      OVERLAY=(55:55,17,ZD,MUL,-1,TO=ZDF,LENGTH=17))
Frank Yaeger - DFSORT Development Team (IBM) - yaeger@us.ibm.com
Specialties: JOINKEYS, FINDREP, WHEN=GROUP, ICETOOL, Symbols, Migration
=> DFSORT/MVS is on the Web at http://www.ibm.com/storage/dfsort
User avatar
Frank Yaeger
Global moderator
 
Posts: 1080
Joined: Sat Jun 09, 2007 8:44 pm
Has thanked: 0 time
Been thanked: 14 times

Re: Change negative ZD to unsigned.

Postby schneiderusa » Wed Mar 24, 2010 11:46 pm

I just tried HIT=NEXT and it doesn't work:
            //SYSIN DD *                                                 
            $                                                           
ICE007A 1 SYNTAX ERROR                                                   
               SORT FIELDS=(9,8,CH,A,22,12,CH,A,42,11,CH,A,484,2,CH,A)   
              SUM FIELDS=(55,17,ZD,73,15,ZD)                             
              OUTREC IFTHEN=(WHEN=(73,15,ZD,LT,0),                       
                OVERLAY=(73:73,15,ZD,MUL,-1,TO=ZDF,LENGTH=15),HIT=NEXT),
               IFTHEN=(WHEN=(55,17,ZD,LT,0),                             
                  OVERLAY=(55:55,17,ZD,MUL,-1,TO=ZDF,LENGTH=17))         
ICE751I 0 C5-K47561 C6-K90014 C7-K45047 C8-K46331 E7-K44564             
ICE052I 3 END OF DFSORT
schneiderusa
 
Posts: 11
Joined: Tue Mar 23, 2010 11:47 pm
Has thanked: 0 time
Been thanked: 0 time

Re: Change negative ZD to unsigned.

Postby dick scherrer » Thu Mar 25, 2010 12:25 am

Hello,

Does "//SYSIN DD *" begin in position 1?

Is "generated statement" anywhere in the output?
Hope this helps,
d.sch.
User avatar
dick scherrer
Global moderator
 
Posts: 6304
Joined: Sat Jun 09, 2007 8:58 am
Has thanked: 3 times
Been thanked: 91 times

Re: Change negative ZD to unsigned.

Postby Frank Yaeger » Thu Mar 25, 2010 1:15 am

schneiderusa,

This has nothing to do with HIT=NEXT.

Your //SYSIN DD * statement is being interpreted as a control statement instead of a JCL statement. It appears you have the // starting in position 3 rather than in position 1. Fix that.
Frank Yaeger - DFSORT Development Team (IBM) - yaeger@us.ibm.com
Specialties: JOINKEYS, FINDREP, WHEN=GROUP, ICETOOL, Symbols, Migration
=> DFSORT/MVS is on the Web at http://www.ibm.com/storage/dfsort
User avatar
Frank Yaeger
Global moderator
 
Posts: 1080
Joined: Sat Jun 09, 2007 8:44 pm
Has thanked: 0 time
Been thanked: 14 times


Return to DFSORT/ICETOOL/ICEGENER

 


  • Related topics
    Replies
    Views
    Last post