Move Date field to numeric field in COBOL
Is there a function in COBOL to move a Date field to a numeric field (yyyymmdd)?

Software/Hardware used:
ASKED: February 28, 2006  1:58 PM
UPDATED: March 2, 2006  10:19 AM

Answer Wiki:
If I understand what you're asking, you've got a date field stored YYYYMMDD and want to change to numeric, or you've got an SQL field, and want it as a numeric YYYYMMDD. Here are both: First: 01 Date-record. 02 Date-field. 03 Year-part PICTURE 9999. 03 Month-part PICTURE 99. 03 Day-part PICTURE 99. 02 Numeric-version PICTURE 99999999 REDEFINES Date-part. Second: 01 Date-record. 02 Date-field. 03 Year-part PICTURE 9999. 03 FILLER PICTURE X. 03 Month-part PICTURE 99. 03 FILLER PICTURE X. 03 Day-part PICTURE 99. 01 Other-record. 02 Date-version. 03 Year-part PICTURE 9999. 03 Month-part PICTURE 99. 03 Day-part PICTURE 99. 02 Numeric-version PICTURE 99999999. ... EXEC SQL SELECT dateField INTO :Date-field FROM x WHERE y=:z. MOVE CORRESPONDING Date-field INTO Date-version.
Last Wiki Answer Submitted:  March 1, 2006  12:32 am  by  SheldonLinker   15 pts.
All Answer Wiki Contributors:  SheldonLinker   15 pts.
To see all answers submitted to the Answer Wiki: View Answer History.


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


 

Let me try to explain this better.

I have file XYZ. In file XYZ I have field ABC that is type DATE (format DATE).

When I copy DD-ALL-FORMATS OF XYZ into my program the definition for field PIC X(10) instead of FORMAT DATE.

If field ABC = ’1969-03-01′ and I move ABC to a numeric field (pic 9(8)). The value in the numeric field is 69000301.

How do I get the copy DD-ALL-FORMATS OF XYZ to define field ABC FORMAT DATE?

 0 pts.

 

I opened a call with IBM software support. I needed CVTOPT(*DATE) in the compile options.

 0 pts.