Equivalent functionality for REDEFINES in Easytrieve

have you already read Easytrieve Variable declaration?

In COBOL, REDEFINES verb can be used to declare variables that share a same memory location.
In Easytrieve also, there is a similar functionality.
For example, the ALPHA and NUMERIC variables given below share the same 5 bytes.

 WS-ALPHA   W        5 A
 WS-NUMERIC WS-ALPHA 5 N

Since the starting position for WS-NUMERIC is given as WS-ALPHA, both of them start from the same memory location.

In case, if you want the same functionality in a File variable,

 FILE INFILE
 IN-REC   1 80 A
 IN-ALPHA     1  5 A
 IN-NUMERIC   1  5 N
 FILLER       6 75 A
Advertisement

6 thoughts on “Equivalent functionality for REDEFINES in Easytrieve”

  1. Example of taking a Numeric field in WS of 6 bytes and breaking it down into 6 seperate alpha bytes please

  2. Hi Prerna,

    WS-AMOUNT-PKD W 4 P 2
    WS-AMOUNT-UNPKD W 6 N 2

    If you want to move the above mentioned packed to unpacked (numeric) data type variable, plz code it as below
    WS-AMOUNT-UNPKD = WS-AMOUNT-PKD * 1

    In EZTV packed format, the size of the field must be declared same as the total memory bytes that is stored. For example, above unpacked variable will be stored in memory as 4 bytes using the formula n/2+1. While converting packed into unpacked, care should be taken to declare a correct size with appropriate dec point.

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out /  Change )

Facebook photo

You are commenting using your Facebook account. Log Out /  Change )

Connecting to %s

This site uses Akismet to reduce spam. Learn how your comment data is processed.