CL/400

20 pts.
Tags:
AS/400 Control Language
CL
CL/400
can any body give me answer to this question please? please give me code in cl with the folling specifications. 1.Accept 2 parameters-date and date type 2.If date type is J then convert date to *MDY format 3.If date type is M convert date to *JUL format 4. Send a program message with the value of converted date? Please give me the answer.Because im practicing in my house.Im taking trining on AS/400.

Answer Wiki

Thanks. We'll let you know when a new response is added.

Hi Venkat,
Here i am providing you the Cl code for the question you asked
but from format i think we should give in specific format thats why i kept from format as *mdy for julian and *jul for *mdy i hope it helps to you if you still have any issues please feel free to ask

0001.00 PGM PARM(&DATE &DATETYP)
0002.00 DCL VAR(&DATE) TYPE(*CHAR) LEN(10)
0003.00 DCL VAR(&DATETYP) TYPE(*CHAR) LEN(1)
0004.00 DCL VAR(&newdate) TYPE(*CHAR) LEN(08)
0005.00
0006.00 IF COND(&DATETYP *EQ ‘J’) THEN(DO)

0007.00 CVTDAT DATE(&DATE) TOVAR(&NEWDATE) FROMFMT(*MDY) +
0008.00 TOFMT(*JUL) TOSEP(/)

0009.00 SNDPGMMSG MSG(&newdate)
0010.00 Enddo
0011.00
0012.00 IF COND(&DATETYP *EQ ‘M’) THEN(DO)

0013.00 CVTDAT DATE(&DATE) TOVAR(&NEWDATE) FROMFMT(*JUL) +
0014.00 TOFMT(*MDY) TOSEP(/)

0015.00 SNDPGMMSG MSG(&newdate)
0016.00 Enddo
0017.00 ENDPGM

Example outputs:
1.For date conversion from *mdy to *jul

Input = ’08359′
Output = ’12/24/08′

2.For date conversion from *mdy to *jul
Input = ’122408′
Output = ”08359′

Thanks,
Mohan K

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
  • BrentSheets
    As400venkatm if you're taking training, as you say, then you should be coming up with the answers yourself. Please do not post any more requests for complete answers. If you run into a problem, then post the code and ask someone to help point out where you're stuck. Do your own homework and ask for help when you've run into a problem. Thanks for your cooperation.
    6,925 pointsBadges:
    report
  • Mohan K
    you are right mr BrentSheets we should ask questions when we stuck up and no way to move ahead
    695 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