Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations SkipVought on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Using the REDEFINES

Status
Not open for further replies.

GC1CEO

Technical User
Feb 16, 2001
12
0
0
US
I'm creating a program which uses the REDEFINES clause in both the input and output sections of the program, where the field size changes depending on the REDEFINES..

Only problem is I am a bit ahead of the class lectures and haven't figured out how to set it in the program so it knows which to use..

If you can help me out, please drop me a note.
 
Hi GC,

If you have a redefines as follows:

Code:
01  redef-fld.
    05 fld-a         pic 9(005) value 12345.
    05 fld-a-red     redefines
       fld-a.
       10 fld-a-3pos pic x(003).
       10 fld-a-2pos pic 9(002).
    .
    .   
    .

01  wrk-fld-x        pic x(007). 
01  wrk-fld-9        pic 9(007).

You use the data names to reference the field you want. For example:

move fld-a-3pos to wrk-fld-x
add fld-a-2pos to fld-a giving wrk-fld-9

Some points to consider:

Only fld-a & fld-a-2pos can be used in arithmetic expressions.

When fld-a-3pos is moved to wrk-fld-x the result is >bb123<
where bb are spaces.

When fld-a-2pos is moved to wrk-fld-9 the result is >0045<.

Hope this helps. Jack.
 
Yep I finally understood it after asking a teacher about it, it just seemed to me that some kind of additional functions or verbs were neccesary to invoke the other fields... Chris Green
Computer Information Systems Student
Cayuga Community College -- Fulton
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top