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

Converting a file from PD to display format.


IBM Mainframe Forums -> SYNCSORT
Post new topic   Reply to topic
View previous topic :: View next topic  
Author Message
chillmo

New User


Joined: 31 Aug 2017
Posts: 30
Location: USA

PostPosted: Thu Jan 14, 2021 12:32 pm
Reply with quote

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
View user's profile Send private message
Nic Clouston

Global Moderator


Joined: 10 May 2007
Posts: 2455
Location: Hampshire, UK

PostPosted: Thu Jan 14, 2021 5:20 pm
Reply with quote

I would start by looking at IFTHEN.
Back to top
View user's profile Send private message
chillmo

New User


Joined: 31 Aug 2017
Posts: 30
Location: USA

PostPosted: Thu Jan 14, 2021 6:21 pm
Reply with quote

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.. icon_redface.gif icon_redface.gif ).

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.. icon_super.gif 36_8_15.gif ).

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
View user's profile Send private message
sergeyken

Senior Member


Joined: 29 Apr 2008
Posts: 2012
Location: USA

PostPosted: Thu Jan 14, 2021 6:32 pm
Reply with quote

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
View user's profile Send private message
Rohit Umarjikar

Global Moderator


Joined: 21 Sep 2010
Posts: 3049
Location: NYC,USA

PostPosted: Fri Jan 15, 2021 1:50 am
Reply with quote

Editing numeric fields
Note- It is for DFSORT but concept is same for SYNCSORT with some more or less feature.
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 -> SYNCSORT

 


Similar Topics
Topic Forum Replies
No new posts How to split large record length file... DFSORT/ICETOOL 10
No new posts Populate last day of the Month in MMD... SYNCSORT 2
No new posts Extracting Variable decimal numbers f... DFSORT/ICETOOL 17
No new posts SFTP Issue - destination file record ... All Other Mainframe Topics 2
No new posts Modifying Date Format Using DFSORT DFSORT/ICETOOL 9
Search our Forums:

Back to Top