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
 

 

To deal with trailing sign value

 
Post new topic   Reply to topic    IBMMAINFRAMES.com Support Forums -> DFSORT/ICETOOL
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    Post subject: To deal with trailing sign value
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

DFSORT Moderator


Joined: 09 Mar 2011
Posts: 7223

PostPosted: Wed Oct 12, 2011 5:48 pm    Post subject: Reply to: To deal with trailing sign value
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    Post subject:
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

Global Moderator


Joined: 14 Mar 2007
Posts: 10201
Location: italy

PostPosted: Wed Oct 12, 2011 6:11 pm    Post subject: Reply to: To deal with trailing sign value
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

DFSORT Moderator


Joined: 09 Mar 2011
Posts: 7223

PostPosted: Wed Oct 12, 2011 8:10 pm    Post subject:
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 Moderator


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

PostPosted: Wed Oct 12, 2011 11:09 pm    Post subject:
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    Post subject:
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

DFSORT Moderator


Joined: 09 Mar 2011
Posts: 7223

PostPosted: Fri Oct 14, 2011 4:21 pm    Post subject:
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    Post subject:
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

DFSORT Moderator


Joined: 09 Mar 2011
Posts: 7223

PostPosted: Fri Oct 14, 2011 6:24 pm    Post subject: Reply to: To deal with trailing sign value
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    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 Add Trailing Zeroes depending upon th... Rohit Umarjikar DFSORT/ICETOOL 3 Fri Oct 23, 2015 1:47 am
No new posts Removing Leading Spaces and Removing ... rahulpala COBOL Programming 4 Fri Sep 04, 2015 4:58 am
No new posts IGZ0040S An invalid separate sign was... kishpra COBOL Programming 13 Sun Aug 02, 2015 2:41 am
No new posts How to modify the value using the sig... Vinay Pushpala PL/I & Assembler 3 Fri Feb 13, 2015 2:10 pm
No new posts SUM FIELDS of ZONED DECIMAL as DISPLA... mrgnndhmk JCL & VSAM 1 Mon Aug 11, 2014 9:16 pm


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