|
View previous topic :: View next topic
|
| Author |
Message |
chillmo
New User
Joined: 31 Aug 2017 Posts: 54 Location: USA
|
|
|
|
I have to convert a file with COMP-3 fields to display format.
| Code: |
| 05 DP-BIG-BAL PIC S9(11)V99 COMP-3. |
However, the display copybook has an indicator for the sign.
| Code: |
05 WS-BIG-BAL-IND PIC X(1).
05 WS-BIG-BAL PIC 9(11)V99. |
My question is, can I interrogate the balance field to determine if the sign should be "+" or "-" in one sort step? I simply hardcoded the "+" (positive sign).
| Code: |
35:C'+',
36:35,7,PD,TO=ZDF,LENGTH=13 |
Any assistance would be greatly appreciated!
Thanks! |
|
| Back to top |
|
 |
Nic Clouston
Global Moderator
Joined: 10 May 2007 Posts: 2454 Location: Hampshire, UK
|
|
|
|
| I would start by looking at IFTHEN. |
|
| Back to top |
|
 |
chillmo
New User
Joined: 31 Aug 2017 Posts: 54 Location: USA
|
|
|
|
My sincere apologies Nic, I tried IFTHEN but it didn't work (and shame on me for NOT posting the code with my respective error message.. ).
In searching the forum, it didn't work as I neglected to use HIT=NEXT and my syntax was incorrect. Problem resolved (with assistance from you.. ).
Here's the code:
| Code: |
INREC IFTHEN=(WHEN=(35,7,PD,LT,0),
OVERLAY=(74:C'-'),HIT=NEXT),
IFTHEN=(WHEN=(35,7,PD,GE,0),
OVERLAY=(74:C'+'),HIT=NEXT),
IFTHEN=(WHEN=(42,7,PD,LT,0),
OVERLAY=(75:C'-'),HIT=NEXT),
IFTHEN=(WHEN=(42,7,PD,GE,0),
OVERLAY=(75:C'+'),HIT=NEXT)
OUTREC FIELDS=(1:1,34,
35:74,1,
36:35,7,PD,TO=ZDF,LENGTH=13,
49:75,1,
50:42,7,PD,TO=ZDF,LENGTH=13) |
I'm sure there's a more efficient way, but this works for me.
Thanks again! |
|
| Back to top |
|
 |
sergeyken
Senior Member

Joined: 29 Apr 2008 Posts: 2275 Location: USA
|
|
|
|
Do it as single unpack, and consider your “IND” field as part of single output field for this unpack.
| Code: |
| BUILD=(...,35:35,7,PD,ZD,EDIT=(STTTTTTTTTTT.TT),SIGNS=(+,-),...) |
|
|
| Back to top |
|
 |
Rohit Umarjikar
Global Moderator

Joined: 21 Sep 2010 Posts: 3109 Location: NYC,USA
|
|
|
|
Editing numeric fields
Note- It is for DFSORT but concept is same for SYNCSORT with some more or less feature. |
|
| Back to top |
|
 |
|
|
 |
All times are GMT + 6 Hours |
|