Use CVTDAT to convert date formats

15 pts.
Tags:
CL
CL/400
CVTDAT
I have taken 2 parameters(like date and date types). A. If suppose date type is j, now i want to convert date to *MDY format B. If date type is M,now i want to convert date to *JUL format C, sending a Program message with the value of converted date. (With use of CVTDAT in cl coding.) Can anyone help?

Answer Wiki

Thanks. We'll let you know when a new response is added.
Send me notifications when members answer or reply to this question.

REGISTER or login:

Forgot Password?
By submitting you agree to receive email from TechTarget and its partners. If you reside outside of the United States, you consent to having your personal data transferred to and processed in the United States. Privacy

Discuss This Question: 2  Replies

 
There was an error processing your information. Please try again later.
Thanks. We'll let you know when a new response is added.
Send me notifications when members answer or reply to this question.

REGISTER or login:

Forgot Password?
By submitting you agree to receive email from TechTarget and its partners. If you reside outside of the United States, you consent to having your personal data transferred to and processed in the United States. Privacy
  • WoodEngineer
    Here is a sample of code from an old RPG program we still use that accomplishes what you request. We call it from the CL. It returns the results to the CL program. This section of code gives you an idea of how this can be done: C *MDY0 TEST (D) DAT_C6 51 (*IN51 On if date test failed) C IF NOT *IN51 (Date is in MMDDYY format) C do something here C GOTO @TAG01 C ENDIF * C *CYMD0 TEST (D) DAT_C7 51 (test for CYYMMDD format without separator) C IF NOT *IN51 (Date is in CYYMMDD format) C do something here C GOTO @TAG01 C ENDIF C *YMD0 TEST(D) DAT_C6 51 (test of YYMMDD format without separator) C IF NOT *IN51 (Date is in YYMMDD format) C do something here C GOTO @TAG01 C ENDIF This code makes a lot more sense when its rendered in fixed font. Notice how the various date formats are tested. If the test fails, it tests a different format looking for one that is valid. Just code a date test for every format you think the program will encounter. If all tests fail, its an invalid date. I warned you . . . this is really old code but it works. You can do the same thing in free form RPG and it looks a lot better.
    6,540 pointsBadges:
    report
  • TomLiotta
    A very similar question was asked earlier. Almost so similar that I would think it was a homework question. Even so, at the time of the earlier question, I couldn't make much sense of what was wanted. This time it makes a little more sense. The program (or procedure) will accept two parms, a date variable in some knoen format a a code letter. Each code letter will correspond to a specific date format. When the code letter is 'j', the program should convert the input date to *MDY format. When the code is 'M', the conversion should be to *JUL format. The output should be in the form of a message sent with SNDPGMMSG. The format of the input date is critical. It seems possible that code 'j' means that the input date is in julian format and should be converted to *MDY. Code 'M' would provide the opposite conversion. Unfortunately, if this is indeed homework, the question should identify it as homework, should show the work that has already been done and should describe what obstacle needs explanation. Answers should be limited to explanation of the meaning of the obstacle and methods to overcome it. Answers should be guidance rather than straight substitution of work. Students can benefit from professional guidance. Tom
    125,585 pointsBadges:
    report

Forgot Password

No problem! Submit your e-mail address below. We'll send you an e-mail containing your password.

Your password has been sent to:

To follow this tag...

There was an error processing your information. Please try again later.

REGISTER or login:

Forgot Password?
By submitting you agree to receive email from TechTarget and its partners. If you reside outside of the United States, you consent to having your personal data transferred to and processed in the United States. Privacy

Thanks! We'll email you when relevant content is added and updated.

Following