EDIT MASKS – Masking variables in Easytrieve

have you already read Easytrieve Variable declaration?

For creating reports, or printing (displaying) numeric variables, we will always need masking. It can be used to print the decimal character for the variables that have implied decimal

 WS-SSN W 9 N MASK '999-99-9999'
 MOVE 123456789 TO WS-SSN

This will be printed as

 WS-SSN : 123-45-6789

Edit mask pattern is created by using combinations of the following characters:

9 — causes a digit to print. (including leading zeros)

Z — causes a digit to print (except for leading zeros)

$ — causes a currency symbol to print prior to the first non-zero digit

more examples to come..

4 thoughts on “EDIT MASKS – Masking variables in Easytrieve”

  1. In EZT could you edit a field to have both $ AND (-) symbol if negative value. (EX: $ – 12.00). or, is there another way?

  2. yes, but the sign should be at the last.

    DEFINE WS-AMOUNT1 W 5 N 2 MASK ‘$999.99-‘
    DEFINE WS-AMOUNT2 W 5 N 2 MASK ‘$999.99-‘
    WS-AMOUNT1 = -12
    WS-AMOUNT2 = 12

    output of this will be:

    WS-AMOUNT1 : $012.00-
    WS-AMOUNT2 : $012.00

  3. Hi,

    Can we use length of the field to move the data in it. To be clear, the input file is 15 bytes
    first 10 is an varchar field NAME and remaining 5 is an normal alphanumeric emp id.

    Data in it : 4RAJA12345

    FIRST BYTE : length of the varchar data
    2nd – 5th pos. : varchar data eventhough allocated size is 10 bytes, we get only 4 bytes of data
    6th – 10 pos. : emp id.

    This an unload file from table.

    How can i move the name alone to name1 of output and emp id to empid1 of output. Is there any way i can use the length of the data received to handle this in easytrieve.

  4. in that case, you can group variables

    WS-DATA 1 10 A
    WS-NAME WS-DATA +1 4 A
    WS-EID WS-DATA +5 5 N

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 )

Twitter picture

You are commenting using your Twitter 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.