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!

how I do that ?? 1

Status
Not open for further replies.

Guest_imported

New member
Jan 1, 1970
0
0
0
I have a variable
01 DAT PIC X(10)
01 NUM PIC 9(10)
The content in DAT is 123
When I display DAT appear 123
if I convert to number apear NUM
1230000000

I want to take the number 123 into a numeric
value , not 1230000000

How can I do this ??
Tanks ..

 
This is in POWER COBOL V.6.1 but it's the same thing
ENVIRONMENT DIVISION.
DATA DIVISION.
WORKING-STORAGE SECTION.
01 CONTROLLI.
03 XDAT PIC X(10).
03 NDAT PIC 9(10).
PROCEDURE DIVISION.
A.
MOVE SPACE TO XDAT

MOVE 0 TO NDAT

MOVE "Text" OF TB-N3 TO XDAT *> POWER COBOL

COMPUTE NDAT = FUNCTION NUMVAL(XDAT)
MOVE NDAT TO "Text" OF TB-N4 *> POWER COBOL

EXIT PROGRAM.
regards
fsccdm
 

There is another way to by pass the problem

ENVIRONMENT DIVISION.
DATA DIVISION.
WORKING-STORAGE SECTION.
01 DUMMY PIC S9(9) COMP-5.
01 CONTROLLI.
03 XDAT PIC X(10).
03 NDAT PIC 9(10).
PROCEDURE DIVISION.
A.

MOVE "Text" OF TB-N3 TO DUMMY
MOVE DUMMY TO NDAT.


EXIT PROGRAM.

Remember, when you use an "alphanumeric" item, as it is a "Textbox" control, all "alpha" value can be converted passing its value to a DUMMY field defines PIC S9(9) COMP-5.

That's all.

Gianni
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top