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

To deal with trailing sign value


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

New User


Joined: 16 Feb 2010
Posts: 46
Location: India

PostPosted: Wed Oct 12, 2011 5:06 pm
Reply with quote

Hi,

I have a requirement where I have a field which is generated from the program in display format. For a specific field the amount value has a trailing sign. I want the trailing sign to be in the leading position when representing negative values.

Here is my JCL
--------------------

Code:
//STEP1    EXEC PGM=SORT
//SYSOUT     DD SYSOUT=*
//SYSIN      DD *
  SORT FIELDS=(32,4,A,1,11,A),FORMAT=CH
  OUTREC FIELDS=(01:01,11,
                 16:32,4,
                 21:36,9,ZD,EDIT=(SIIIIIIIT.TT),SIGNS=(,-),
                 131:C' ')

input file
---------------
Code:

XXXX        E100UE              1023000171214-å000000
XXXX        E100UE              1023000134306-000000
XXXXXXX     E100UE              1023000153205-000000
XXXX        E100UE              1023000270768-000000
XXXX        E100UE              1023000192393-000000

output file
------------

Code:
XXXX          1023      1712.14
XXXX          1023      5154.72
XXXX          1023      3992.47
XXXX          1023      4381.97
XXXX          1023      4212.88


There is no error but the negative sign is ignored here.

Could someone help me to get to the resoution on this.
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: Wed Oct 12, 2011 5:48 pm
Reply with quote

You have to find a data format which understands a sign, and increase your field length by one, or test the sign character, and subtract your value from zero (to make it negative). The former is better.
Back to top
View user's profile Send private message
Skss

New User


Joined: 16 Feb 2010
Posts: 46
Location: India

PostPosted: Wed Oct 12, 2011 6:04 pm
Reply with quote

is there any way in sort that handles trailing sign?
Back to top
View user's profile Send private message
enrico-sorichetti

Superior Member


Joined: 14 Mar 2007
Posts: 10873
Location: italy

PostPosted: Wed Oct 12, 2011 6:11 pm
Reply with quote

please learn how to use the code tags...
it will preserve the alignment making things easier for people willing to answer
it will also save moderators the time to fix the things icon_biggrin.gif
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: Wed Oct 12, 2011 8:10 pm
Reply with quote

Skss wrote:
is there any way in sort that handles trailing sign?


Did you read what I wrote? Try Table 8 in the "DFSORT Application Programming Guide". Check around on the other types at the same time, so you know what is available and where to look next time.
Back to top
View user's profile Send private message
Frank Yaeger

DFSORT Developer


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

PostPosted: Wed Oct 12, 2011 11:09 pm
Reply with quote

Skss,

Your problem is that you are trying to use ZD format, but your values are NOT ZD. ZD does NOT have a trailing minus sign (it has the sign in the zone of the last byte, e.g. X'D5' for -5). You need to use the correct format, which would be SFF in this case.

Code:

    21:36,9,SFF,EDIT=(SIIIIIIIT.TT),SIGNS=(,-),


will work if the value in 36,9 is dddddddd-. However, I'd suggest you check if that really is the correct starting position and length for your field. I can't tell from what you posted.
Back to top
View user's profile Send private message
Skss

New User


Joined: 16 Feb 2010
Posts: 46
Location: India

PostPosted: Fri Oct 14, 2011 3:33 pm
Reply with quote

Hi Frank,

I did as per your suggestion but I am not getting the result I am expecting.

To explain further here is what I have done

Here are some of my input records
Code:

----+----1----+----2----+----3----+----4----+----5----+--
92027536   E100UE              1027000020000 000000
92027534   E100UE              1027000005800-000000
92027534   E100UE              1023000192695 000000
92027541   E100UE              1023000438814 000000


sort card used :
Code:
21:36,9,SFF,EDIT=(SIIIIIIIT.TT),SIGNS=(,-)


Output file :
Code:

92027534       1027        58.00
92027536       1027        200.00


if you observe 92027534 it has a value 000005800-
But if you see the output file then it is still showing a +ve value

Hope this explains it.
Please let me know if you need any more information on the same.
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: Fri Oct 14, 2011 4:21 pm
Reply with quote

Skss wrote:
[...]

sort card used :
Code:
21:36,9,SFF,EDIT=(SIIIIIIIT.TT),SIGNS=(,-)


[...]


From my quick count you are only including the digits in the length of nine. How about trying with a length of 10?
Back to top
View user's profile Send private message
Skss

New User


Joined: 16 Feb 2010
Posts: 46
Location: India

PostPosted: Fri Oct 14, 2011 5:27 pm
Reply with quote

thank you so much to all of u.....

it worked icon_smile.gif
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: Fri Oct 14, 2011 6:24 pm
Reply with quote

I'm glad it is working.

I do have to say that you could have had your answer by about 12:30pm (GMT) on Wednesday. Or 6pm when Frank Yaeger gave you the specific field suggested you check the start and length of your field.

Please review the thread and see how you could have got their quicker, so that next time you can get another answer yourself without having to even ask, because of what you have learned this time.

Have a good weekend.
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
This topic is locked: you cannot edit posts or make replies. Missing Negative sign in COBOL COBOL Programming 6
No new posts SUSBSCRIPT WITH SIGN IN PIC CLAUSE COBOL Programming 3
No new posts Typing the CENT sign ¢ on mainframe,... All Other Mainframe Topics 2
No new posts IEBGENER to copy from FB to VB and re... All Other Mainframe Topics 3
No new posts Convert Numeric to Packed decimal and... DFSORT/ICETOOL 5
Search our Forums:

Back to Top