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

Converting neg values to positive and viceversa for Var file


IBM Mainframe Forums -> JCL & VSAM
Post new topic   Reply to topic
View previous topic :: View next topic  
Author Message
MSTP

New User


Joined: 21 Jun 2007
Posts: 30
Location: Baltimore

PostPosted: Sat Apr 24, 2010 12:24 am
Reply with quote

Hi

I have a variable length file and it has many dollar fields of form
S9(05)V99 & S9(05)V99 at various positions in the record.The requirement is to convert the negative values to positive and positive values to negative.Can this be done in SORT and if so how.Please help. thanks in advance.

mstp
Back to top
View user's profile Send private message
dick scherrer

Moderator Emeritus


Joined: 23 Nov 2006
Posts: 19244
Location: Inside the Matrix

PostPosted: Sat Apr 24, 2010 12:54 am
Reply with quote

Hello,

You could multiply the numbers by -1 to "flip" the sign. . .
Back to top
View user's profile Send private message
MSTP

New User


Joined: 21 Jun 2007
Posts: 30
Location: Baltimore

PostPosted: Sat Apr 24, 2010 1:00 am
Reply with quote

I wanted to do multiply by -1 but there are lot of fields and since this is variable length file don't know how many occurences will I get. Just looking for any eazy approach
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: Sat Apr 24, 2010 1:04 am
Reply with quote

What sign is used for the positive values - C or F?

Are the values to be converted only in specific positions in the record? If so, what positions. If not, please explain.
Back to top
View user's profile Send private message
MSTP

New User


Joined: 21 Jun 2007
Posts: 30
Location: Baltimore

PostPosted: Sat Apr 24, 2010 1:14 am
Reply with quote

The sign used for positive is C and for negative is D.
The record layout has 4 occurs caluse and each can go upto 99 times.And in each occurs caluse there are some S9(05)V99 fields and S9(04)V99 fields.
Back to top
View user's profile Send private message
Bill O'Boyle

CICS Moderator


Joined: 14 Jan 2008
Posts: 2501
Location: Atlanta, Georgia, USA

PostPosted: Sat Apr 24, 2010 1:22 am
Reply with quote

Just to confirm, are these numeric fields defined as Signed Display-Numeric or Signed Packed-Decimal?

In other words, Signed Display-Numeric will have a positive last-byte equal to X'C0' through X'C9' and Signed Packed-Decimal will have a positive last-byte equal to X'0C' through X'9C'.

X'C0' through X'C9' is a '{' through 'I', which presents a dilemma.

How would you distinguish these values as sign-bytes, which require conversion, from legitimate bytes which should not be converted.

Are the numeric fields consecutive or are they interspersed?

Bill
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: Sat Apr 24, 2010 1:59 am
Reply with quote

I was going to suggest using FINDREP, but I'm still not clear on what your records look like.

Quote:
And in each occurs caluse there are some S9(05)V99 fields and S9(04)V99 fields.


Do the occurs clauses only have ZD fields, or can they have non-numeric fields as well? At what position does each occurs clause start?

FINDREP can be limited to operate between specific starting and ending positions (even for VB records where various numbers of fields are present). But I can't tell you how to do what you want (or if you can) unless I have a better idea of what your records actually look like.

Perhaps you should just read up on FINDREP and IFTHEN FINDREP and see if they can be used to do what you want. You can find more information on FINDREP and IFTHEN FINDREP at:

www.ibm.com/support/docview.wss?rs=114&uid=isg3T7000085
Back to top
View user's profile Send private message
MSTP

New User


Joined: 21 Jun 2007
Posts: 30
Location: Baltimore

PostPosted: Sat Apr 24, 2010 2:29 am
Reply with quote

Attached is the layout of the file and all the numeric fields are Signed Display-Numeric .
Code:
  01  IN-REC.
    05  IN-PRM-CUR-PTD-ENH-PRM-AMT              PIC S9(04)V99.
    05  IN-PRM-CUR-PTD-LENR-PNTY                PIC S9(04)V99.
    05  IN-PRM-CUR-PTD-LI-PRM-SAMT              PIC S9(04)V99.
    05  IN-PRM-CUR-PTD-LENR-P-SAMT              PIC S9(04)V99.
    05  IN-PRM-PTC-CUR-PRO-IND                  PIC X.         
    05  IN-PRM-PTC-ARR-PRO-IND                  PIC X.         
    05  IN-PRM-PTC-OVR-PRO-IND                  PIC X.         
    05  IN-PRM-PTD-CUR-PRO-IND                  PIC X.         
    05  IN-PRM-PTD-ARR-PRO-IND                  PIC X.         
    05  IN-PRM-PTD-OVR-PRO-IND                  PIC X.         
    05  IN-PRM-PTC-PLN-ARR-DATA-OCC             PIC 9(03).     
    05  IN-PRM-PTC-PLN-OVR-DATA-OCC             PIC 9(03).     
    05  IN-PRM-PTD-PLN-ARR-DATA-OCC             PIC 9(03).     
    05  IN-PRM-PTD-PLN-OVR-DATA-OCC             PIC 9(03).     
    05  FILLER                                  PIC X(31)     
                                           VALUE     SPACES.   
    05  IN-PRM-PTC-PLN-ARR OCCURS 1 TO 99 TIMES DEPENDING ON   
        IN-PRM-PTC-PLN-ARR-DATA-OCC INDEXED BY PCA-NDX.       
        10  IN-PRM-PTC-PLN-ARR-PLN-ID           PIC X(11).     
        10  IN-PRM-PTC-ARR-TRUNC                PIC S9(04)V99.
        10  IN-PRM-PTC-PLN-ARR-MON              PIC 9(6).     
    05  IN-PRM-PTC-PLN-OVR OCCURS 1 TO 99 TIMES DEPENDING ON   
        IN-PRM-PTC-PLN-OVR-DATA-OCC INDEXED BY PCO-NDX.       
        10  IN-PRM-PTC-PLN-OVR-PLN-ID           PIC X(11).     
        10  IN-PRM-PTC-OVR-TRUNC                PIC S9(04)V99.
        10  IN-PRM-PTC-PLN-OVR-MON              PIC 9(6).     
    05  IN-PRM-PTD-PLN-ARR OCCURS 1 TO 99 TIMES DEPENDING ON   
        IN-PRM-PTD-PLN-ARR-DATA-OCC INDEXED BY PDA-NDX.       
        10  IN-PRM-PTD-PLN-ARR-PLN-ID           PIC X(11).     
        10  IN-PRM-PTD-ARR-TRUNC                PIC S9(04)V99.
        10  IN-PRM-PTD-PLN-ARR-MON              PIC 9(6).     
        10  IN-PRM-PTD-PLN-BRP-ARR              PIC S9(04)V99.
        10  IN-PRM-PTD-PLN-EPP-ARR              PIC S9(04)V99.
        10  IN-PRM-PTD-PLN-LEP-ARR              PIC S9(04)V99.
        10  IN-PRM-PTD-PLN-LIS-ARR              PIC S9(04)V99.
        10  IN-PRM-PTD-PLN-LIS-LEP-ARR          PIC S9(04)V99.
     05 IN-PRM-PTD-PLN-OVR OCCURS 1 TO 99 TIMES DEPENDING ON   
        IN-PRM-PTD-PLN-OVR-DATA-OCC INDEXED BY PDO-NDX.       
        10  IN-PRM-PTD-PLN-OVR-PLN-ID           PIC X(11).     
        10  IN-PRM-PTD-OVR-TRUNC                PIC S9(04)V99.
        10  IN-PRM-PTD-PLN-OVR-MON              PIC 9(6).     
        10  IN-PRM-PTD-PLN-BRP-OVR              PIC S9(04)V99.
        10  IN-PRM-PTD-PLN-EPP-OVR              PIC S9(04)V99.
        10  IN-PRM-PTD-PLN-LEP-OVR              PIC S9(04)V99.
        10  IN-PRM-PTD-PLN-LIS-OVR              PIC S9(04)V99.
        10  IN-PRM-PTD-PLN-LIS-LEP-OVR          PIC S9(04)V99.
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: Sat Apr 24, 2010 2:40 am
Reply with quote

There is no practical way with DFSORT to do this because your occurs clauses have mixed non-numeric and numeric fields in different places in different records. So there's no way to tell which field type is which and thus no way to distinguish between (for example) X'C1' as an 'A' character in the non-numeric fields vs X'C1' as a +1 in the numeric fields.
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 -> JCL & VSAM

 


Similar Topics
Topic Forum Replies
No new posts Compare 2 files and retrive records f... DFSORT/ICETOOL 3
No new posts FTP VB File from Mainframe retaining ... JCL & VSAM 8
No new posts Issues Converting From ZD to Signed N... DFSORT/ICETOOL 4
No new posts Extract the file name from another fi... DFSORT/ICETOOL 6
No new posts How to split large record length file... DFSORT/ICETOOL 10
Search our Forums:

Back to Top