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 Chris Miller on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Getting Rid of Packed Data on Date Field

Status
Not open for further replies.

jjc3397

Programmer
Dec 21, 2003
55
US
I have a Cobol Program that has Comp-3 Packed Data on the field Lic-Exp-Date. How do I get rid of the packed data field so that I can use the Lic-Exp-Date in a If Statement to move 'A' for Active to a Rec-Status Field.



Read Lic File
If Lic-Exp-Date = 093006
Move 'A' to Rec-Status
Read Next Record
 
Move the Comp-3 field to Pic 9(somesize) usage display.

Hope This Helps, PH.
Want to get great answers to your Tek-Tips questions? Have a look at FAQ219-2884 or FAQ181-2886
 
You shouldnt have to do anything. The if statement will work fine with the comp-3 field.
 
Well you might have to move it to a char field to edit it and make it look like a date.

pic xxbxxbxx

Then use inspect and replace the blanks with the separator of your choice.

i.e. xx/xx/xx

Depends if you want the date to be numeric or charcter. I am kind of preferential to yyyymmdd myself.

If you have a field:

01 Date-x.
05 Date-9 pic 9(06).

A group move is character and the 05 is numeric.

Anyway you can play with it.

Native Cobol does not really have a date type of object oriented field type.

If you do not like my post feel free to point out your opinion or my errors.
 
Lots of replies already, but EXACTLY what does the CURRENT definition (and if it is a subordinate item, what does the group) LOOK like, e.g.

05 Lic-Exp-Date Pic 9(06) Comp-3.

or

05 Lic-Exp-Date.
10 LED-dd Pic 99 Comp-3
10 LED-mm Pic 99 Comp-3.
10 LEd-yy Pic 99 Comp-3.

or something else?

This will (or may) impact how the IF statement works.

P.S. I am with those who HATE storing a date as DDMMYY - which it LOOKS to me as if you have.

Bill Klein
 
I am use to storing a date as yyyymmdd. It makes sense in a way because when you sort on the date it is natural to sort by Year, Month, Day. Also it makes it easier to compare dates.

This is my opinion.

Databases use just a number which is a certain number of days since a set day or before that date if negative. I dont know how exactly they implement the date unless they just have a giant array they look it up in or something. I had a class in rule based programming once and we made our own java class for dates. It was rather interesting to build it from scratch. You can figure out year month day I guess with just some simple mathematical calculations.

If you do not like my post feel free to point out your opinion or my errors.
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top