Ed Goodman wrote:That SEEMS like such a simple question, but you're in for some studying! You're going to have to learn how the mainframe stores data.
The 'V' is an implied decimal. You won't actually see it in the data, but the program will know that's where the decimal goes.
I just spent a few minutes looking for a good example, and can't find one. What I recommend you do it...write a small cobol program. Put all those variable types in it and have it either display them or write them to a record. Then open the sysout or the file and look at how they are formatted.
Don't forget to use COMP and COMP-3 types.
I have done something like that
UNSTRING W-ENR-TYPEPIC DELIMITED BY '(' OR ')'
IF W-ENR-PIC = 'PIC' AND W-ENR-TAB NOT = 'OCCURS'
MOVE W-ENR-DONNEE TO DONNEE-DATA
MOVE SPACES TO W-ENR-NIVEAU
MOVE SPACES TO W-ENR-DONNEE
MOVE SPACES TO W-ENR-PIC
MOVE SPACES TO W-ENR-TYPEPIC
MOVE W-LONGUEUR TO W-LONG
MISE EN FORME PICTURE D'EDITION
EVALUATE W-PIC ALSO W-ENR-TAB
WHEN 'X' ALSO SPACES
MOVE 'C' TO TYPE-DATA
WHEN '9' ALSO SPACES
MOVE 'N' TO TYPE-DATA
WHEN 'S9' ALSO SPACES
MOVE 'Z' TO TYPE-DATA
WHEN 'S9' ALSO 'COMP-3'
MOVE 'P' TO TYPE-DATA
WHEN 'S9' ALSO 'COMP'
MOVE 'B' TO TYPE-DATA
if someone declares in pic 99 or pic 9(03)v99 instead of pic 9(02) or pic 9(03)v9(02) it won't work
ps: if i have PIC X(10)V9(02) X(10)V9(02) : W-ENR-TYPEPIC
- X : W-PIC
- 10 : W-LONGUEUR
- V9 : W-PIC-DEC
- 02: W-LONG-DEC