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
 

 

Converting neg values to positive and viceversa for Var file

 
Post new topic   Reply to topic    IBMMAINFRAMES.com Support Forums -> JCL & VSAM
View previous topic :: :: View next topic  
Author Message
MSTP

New User


Joined: 21 Jun 2007
Posts: 29
Location: Baltimore

PostPosted: Sat Apr 24, 2010 12:24 am    Post subject: Converting neg values to positive and viceversa for Var file
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

Site Director


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

PostPosted: Sat Apr 24, 2010 12:54 am    Post subject:
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: 29
Location: Baltimore

PostPosted: Sat Apr 24, 2010 1:00 am    Post subject:
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 Moderator


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

PostPosted: Sat Apr 24, 2010 1:04 am    Post subject:
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: 29
Location: Baltimore

PostPosted: Sat Apr 24, 2010 1:14 am    Post subject:
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: 2502
Location: Atlanta, Georgia, USA

PostPosted: Sat Apr 24, 2010 1:22 am    Post subject: Reply to: Converting neg values to positive and viceversa fo
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 Moderator


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

PostPosted: Sat Apr 24, 2010 1:59 am    Post subject:
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:

http://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: 29
Location: Baltimore

PostPosted: Sat Apr 24, 2010 2:29 am    Post subject:
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 Moderator


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

PostPosted: Sat Apr 24, 2010 2:40 am    Post subject:
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    IBMMAINFRAMES.com Support Forums -> JCL & VSAM All times are GMT + 6 Hours
Page 1 of 1

 

Search our Forum:

Similar Topics
Topic Author Forum Replies Posted
No new posts Sorting of hex values Saurabh_mi DFSORT/ICETOOL 11 Thu May 25, 2017 3:49 pm
No new posts Converting Variable block file to Fix... bhavana yalavarthi DFSORT/ICETOOL 10 Tue May 16, 2017 2:20 pm
No new posts Replace values in the input data Vikas Maharnawar DFSORT/ICETOOL 10 Thu May 11, 2017 2:18 pm
No new posts Getting error while opening a variabl... apandey1 COBOL Programming 5 Fri May 05, 2017 12:22 pm
No new posts Issue with NDM process to transmit ES... chetanambi All Other Mainframe Topics 6 Wed May 03, 2017 10:52 am


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