Roopesh Majeti
Roopesh Majeti

Reputation: 554

Formatting not working in 4gl [ USING clause ]

I was trying to format the output variable as follows:

Scenario 1:

LET msg = "Roopesh Majeti here "
           Empno Using "&&&&&"
Call Logmsg(msg)

In this scenario, the empno get formatted to 5 digits [ I should say spaces ] and gets displayed.

Scenario 2:

Let c_check = "&&"
Let msg ="Roopesh Majeti here"
          Empno using c_check
Call Logmsg(msg)

Here, my expectation is that, whatever is the value of c_check [ say 10 &'s ] then the empno should be formatted to 10 positions/spaces.

But it's not working as expected.

Am I missing anything here?

Upvotes: 2

Views: 3631

Answers (1)

Jonathan Leffler
Jonathan Leffler

Reputation: 753695

You don't say what you do get, which makes it hard to know how it is not working.

You have some minor syntax errors, missing the commas after the constant strings.

You don't show the declaration of msg or c_check; could the problem be that the message is being truncated?

What do you get when you use:

DISPLAY "<<", msg CLIPPED, ">>"
DISPLAY "<<", msg,         ">>"

You should be able to show us a complete program like this, and its output:

MAIN

    DEFINE msg      CHAR(64)
    DEFINE c_check  CHAR(20)
    DEFINE empno    INTEGER

    LET empno = 12345
    LET msg = "Roopesh Majeti here ", empno Using "&&&&&"
    DISPLAY "<<", msg CLIPPED, ">>"
    DISPLAY "<<", msg,         ">>"

    LET empno = 987654321
    LET c_check = "&&"
    LET msg ="Roopesh Majeti here", empno USING c_check
    DISPLAY "<<", msg CLIPPED, ">>"
    DISPLAY "<<", msg,         ">>"

END MAIN

Upvotes: 1

Related Questions