50 pts.
 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: October 26, 2009  1:01 PM
UPDATED: March 17, 2010  11:04 PM

Answer Wiki:
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 Wiki Answer Submitted:  October 29, 2009  3:54 am  by  Meandyou   5,205 pts.
All Answer Wiki Contributors:  Meandyou   5,205 pts. , TomLiotta   107,735 pts.
To see all answers submitted to the Answer Wiki: View Answer History.


Discuss This Question:
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _


 

Try externally described printer file. From that set up multiple print lines. Print the corresponding line you need.

 195 pts.