COBOL: Is it possible to apply a different Pic clause to a single variable?
35 pts.
0
Q:
COBOL: Is it possible to apply a different Pic clause to a single variable?
Is it possible to use a different  Pic clause from a single variable? based on the condition.

DEBIT             PIC ZZZZZZZ,ZZZ,ZZ9.99                      PIC ZZZ,ZZZ,ZZZ,ZZ9.99 For example              When true                          DEBIT should act as a PIC ZZZZZZZ,ZZZ,ZZ9.99              else                         DEBIT should act as a PIC  ZZZ,ZZZ,ZZZ,ZZ9.99

Please Suggesst me..



Software/Hardware used:
COBOL/400
ASKED: Oct 26 2009  1:01 PM GMT
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _
0
35 pts.
0
A:
 RATE THIS ANSWER
0
Click to Vote:
  •   0
  •  0
  • AddThis Social Bookmark Button
AFAIK, no.

However, the result that you apparently want can be obtained in at least two different ways.

You can REDEFINE an area with multiple definitons. At run-time, choose which field will be the target for the data you MOVE into it.

You can also simply declare the field as PIC X(18) or however long the space is. Then use edit APIs to apply whatever edit word you want to a value and move the edited value into the field.

Tom

=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=

Or have two edit patterns and move the appropriate one to your output line.

05 DEBIT-TRUE PIC ZZZZZZZ,ZZZ,ZZ9.99.
05 DEBIT-FALSE PIC ZZZ,ZZZ,ZZZ,ZZ9.99.

05 OP-LINE.
10 OP-DEBIT PIC x(18).

IF condition-is-true
MOVE debit-field TO DEBIT-TRUE
MOVE DEBIT-TRUE TO OP-DEBIT
ELSE
MOVE debit-field TO DEBIT-FALSE
MOVE DEBIT-FALSE TO OP-DEBIT.
WRITE op-file FROM OP-LINE.


Hi Your answer is good but my program is very big so i need to change so many lines instead of that only i asked is there any possibility by using single var... Thanks for ur reply..
Last Answered: Oct 29 2009  3:54 AM GMT by Promodhss   35 pts.
Latest Contributors: Meandyou   1840 pts., TomLiotta   8000 pts.
0
0
Discuss This Answer:
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _



0