CL/400
20 pts.
0
Q:
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.
ASKED: Nov 10 2008  5:36 AM GMT
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _
0
470 pts.
0
A:
 RATE THIS ANSWER
0
Click to Vote:
  •   0
  •  0
  • AddThis Social Bookmark Button
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
Last Answered: Nov 10 2008  8:19 AM GMT by Mohan K   470 pts.
0
0
Discuss This Answer:
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _



_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _

BrentSheets   6535 pts.  |   Nov 10 2008  2:31PM GMT

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.

 

Mohan K   470 pts.  |   Nov 11 2008  6:41AM GMT

you are right mr BrentSheets we should ask questions when we stuck up and no way to move ahead

 
0