View previous topic :: View next topic
|
Author |
Message |
Virender Kumar Midha
New User
Joined: 14 Feb 2009 Posts: 2 Location: TCS Towers
|
|
|
|
Hello,
We can have two kind of inputs DEHAM,NUE(could be 3 or 5 alphanumeric) and output should be HAM, NUE(always 3 alphanumeric).
Do we have some some better way to do it except moving NUE it to temp alphanumeric variable of X(3) + X(2) and checking the last two chars.
Thanks in advance. |
|
Back to top |
|
|
Marso
REXX Moderator
Joined: 13 Mar 2006 Posts: 1353 Location: Israel
|
|
|
|
You can use reference modification, no need for REDEFINE or extra temp areas:
Code: |
IF INP-AREA (4:2) = SPACES THEN if 2 spaces on right
MOVE INP-AREA (1:3) TO OUT-AREA take left part of word
ELSE else
MOVE INP-AREA (3:3) TO OUT-AREA take right part of word
END-IF |
Is this what you meant ? |
|
Back to top |
|
|
dick scherrer
Moderator Emeritus
Joined: 23 Nov 2006 Posts: 19244 Location: Inside the Matrix
|
|
|
|
Hello and welcome to the forum,
Suggest you post a more complete definition of the requirement. What you posted is not enough. You need to show more somplete sample records that demonstrate what you may have as input and the output you want from that exact imput. These do not need to be whole records, but enough to show your requirement - particularly the field you mention and the following few fields.
As Marso mentioned, reference modification may be part of your solution but i believe more is also needed. Impossible to say without more complete info. . . |
|
Back to top |
|
|
Virender Kumar Midha
New User
Joined: 14 Feb 2009 Posts: 2 Location: TCS Towers
|
|
|
|
Hello,
But the subscipts INP-AREA(4:2) does not work in the COBOL we have. |
|
Back to top |
|
|
dick scherrer
Moderator Emeritus
Joined: 23 Nov 2006 Posts: 19244 Location: Inside the Matrix
|
|
|
|
Hello,
Quote: |
But the subscipts INP-AREA(4:2) does not work in the COBOL we have. |
Reference modification is not the same as a subscript. If this field is part of an occurs, the syntax is wrong.
Which compiler is used on your system? Yhe first line of compiler output should show this.
Post the error message including the message id from the compile. Post the definition of INP-AREA and the group it belongs to.
As mentioned earlier, you need to better define the requirement with example input/output. |
|
Back to top |
|
|
|