View previous topic :: View next topic
|
Author |
Message |
Skss
New User
Joined: 16 Feb 2010 Posts: 46 Location: India
|
|
|
|
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 |
|
|
Bill Woodger
Moderator Emeritus
Joined: 09 Mar 2011 Posts: 7309 Location: Inside the Matrix
|
|
|
|
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 |
|
|
Skss
New User
Joined: 16 Feb 2010 Posts: 46 Location: India
|
|
|
|
is there any way in sort that handles trailing sign? |
|
Back to top |
|
|
enrico-sorichetti
Superior Member
Joined: 14 Mar 2007 Posts: 10873 Location: italy
|
|
|
|
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 |
|
Back to top |
|
|
Bill Woodger
Moderator Emeritus
Joined: 09 Mar 2011 Posts: 7309 Location: Inside the Matrix
|
|
|
|
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 |
|
|
Frank Yaeger
DFSORT Developer
Joined: 15 Feb 2005 Posts: 7129 Location: San Jose, CA
|
|
|
|
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 |
|
|
Skss
New User
Joined: 16 Feb 2010 Posts: 46 Location: India
|
|
|
|
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 |
|
|
Bill Woodger
Moderator Emeritus
Joined: 09 Mar 2011 Posts: 7309 Location: Inside the Matrix
|
|
|
|
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 |
|
|
Skss
New User
Joined: 16 Feb 2010 Posts: 46 Location: India
|
|
|
|
thank you so much to all of u.....
it worked |
|
Back to top |
|
|
Bill Woodger
Moderator Emeritus
Joined: 09 Mar 2011 Posts: 7309 Location: Inside the Matrix
|
|
|
|
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 |
|
|
|