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

Better Varibles usage


IBM Mainframe Forums -> COBOL Programming
Post new topic   Reply to topic
View previous topic :: View next topic  
Author Message
Virender Kumar Midha

New User


Joined: 14 Feb 2009
Posts: 2
Location: TCS Towers

PostPosted: Sun Feb 15, 2009 12:19 pm
Reply with quote

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

REXX Moderator


Joined: 13 Mar 2006
Posts: 1353
Location: Israel

PostPosted: Sun Feb 15, 2009 6:31 pm
Reply with quote

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

Moderator Emeritus


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

PostPosted: Mon Feb 16, 2009 6:25 am
Reply with quote

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

New User


Joined: 14 Feb 2009
Posts: 2
Location: TCS Towers

PostPosted: Tue Feb 17, 2009 1:35 pm
Reply with quote

Hello,
But the subscipts INP-AREA(4:2) does not work in the COBOL we have.
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: Tue Feb 17, 2009 8:55 pm
Reply with quote

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
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 -> COBOL Programming

 


Similar Topics
Topic Forum Replies
No new posts STEM usage in REXX CLIST & REXX 14
No new posts z/OS Modules Usage report using SMF 42 DFSORT/ICETOOL 2
No new posts Concatenate 2 fields (usage national)... COBOL Programming 2
No new posts JCL and TAPE drives: how to maximize ... JCL & VSAM 9
No new posts Usage of BINSEARCH PL/I PL/I & Assembler 1
Search our Forums:

Back to Top