If you live outside the United States, by submitting your email address you consent to having your personal data transferred to and processed in the United States.
Is it for a report? For a display file? For the CVTDAT command in a CL program? For a RPG or COBOL program to manipulate a date value?
A date format should only be important when a date value is being shown to a human. There might be no standard format name that matches your request, but you can generate it easily enough.
The TEST op-code should trigger %error() if you run it against a date in dd/mm/yyyy format with *EUR0. It should always throw an error if there are any separators like you showed, even if the day, month and year are valid. You need a different method. — Tom
My display file filed is only 8A. Separator is not expected. Need to validate it without separator. Please confirm in that case whether my approach is correct.
That would make sense, but it’s different from what you asked in the question. And the question title means that others will have a harder time when searching for answers. Please ask questions that indicate what you need. Help will be much easier to give. — Tom
The link in the ‘Answer’ is obsolete and does not cover all date formats. A better link might be DATFMT (Date Format) keyword for physical and logical files, but it’s not clear what kind of “date format” you are looking for.
Is it for a report? For a display file? For the CVTDAT command in a CL program? For a RPG or COBOL program to manipulate a date value?
A date format should only be important when a date value is being shown to a human. There might be no standard format name that matches your request, but you can generate it easily enough.
What exactly are you needing to do?
Tom
Through a display file, user is entering date in dd/mm/yyyy format. I need to validate the date and save to file
Thanks everyone, I am done with it with the help of TEST(DE)
C *EUR0 Test(DE) DspfFld
Then catch the %error
The TEST op-code should trigger %error() if you run it against a date in dd/mm/yyyy format with *EUR0. It should always throw an error if there are any separators like you showed, even if the day, month and year are valid. You need a different method. — Tom
My display file filed is only 8A. Separator is not expected. Need to validate it without separator. Please confirm in that case whether my approach is correct.
That would make sense, but it’s different from what you asked in the question. And the question title means that others will have a harder time when searching for answers. Please ask questions that indicate what you need. Help will be much easier to give. — Tom