View previous topic :: View next topic |
Author |
Message |
Meena_ramanathan Beginner
Joined: 25 Oct 2005 Posts: 11 Topics: 7
|
Posted: Tue Oct 25, 2005 11:22 am Post subject: Date validation in cobol |
|
|
Hi,
I want to know if there is any function in cobol by which i can do "date validation".
For exmaple : if i give a date in YYYYMMDD format then it shd tell me the date is valid or not.
Can anyone let me know if there is any link where i can know more about date validation functions?
Pointers will be helpful
Thanks. |
|
Back to top |
|
|
kolusu Site Admin
Joined: 26 Nov 2002 Posts: 12376 Topics: 75 Location: San Jose
|
Posted: Tue Oct 25, 2005 11:48 am Post subject: |
|
|
You can use Language enviroment calls to determine if the input date is a valid date or not.
ex:
Code: |
01 WS-INP-DATE PIC 9(08) VALUE 20050231.
01 WS-OUTPUT PIC S9(9) COMP.
01 WS-FORMAT PIC X(08).
01 WS-FC-CODE.
05 FC-SEVERITY PIC S9(4) COMP.
05 FC-MESSAGE PIC S9(4) COMP.
05 FILLER PIC X(08).
PROCEDURE DIVISION.
MOVE 'YYYYMMDD' TO WS-FORMAT
CALL 'CEEDAYS' USING
WS-INP-DATE,
WS-FORMAT,
WS-OUTPUT,
WS-FC-CODE
IF FC-SEVERITY = 00
DISPLAY 'THE DATE IS A VALID DATE'
ELSE
DISPLAY 'THE DATE IS NOT A VALID DATE'
END-IF
|
Check this link for a detailed explanation of LE callable services.
http://publibz.boulder.ibm.com/cgi-bin/bookmgr_OS390/BOOKS/CEEA3130/3.5?DT=20020625092930
Hope this helps...
Cheers
Kolusu _________________ Kolusu
www.linkedin.com/in/kolusu |
|
Back to top |
|
|
shekar123 Advanced
Joined: 22 Jul 2005 Posts: 528 Topics: 90 Location: Bangalore India
|
Posted: Wed Oct 26, 2005 3:02 pm Post subject: date validation pgm using LE calls |
|
|
Kolusu,
I tried out the date validation pgm as per your code but i am getting the dislay as date not valid even though the format is correct with YYYYMMDD.I also tried out with the format DDMMYYYY but still it shows the same result.I am getting the FC-SEVERITY CODE AS 0003.My code:
Kolusu please tell me how do i avoid posting with spaces being concatinated as in this case my entire code is suppressed / spaces are padded up so that i can post properly from my next posts.
Code: |
WORKING-STORAGE SECTION.
01 WS-INP-DATE PIC 9(08) VALUE 20051027.
01 WS-OUTPUT PIC S9(9) COMP.
01 WS-FORMAT PIC X(08).
01 WS-FC-CODE.
05 FC-SEVERITY PIC S9(4) COMP.
05 FC-MESSAGE PIC S9(4) COMP.
05 FILLER PIC X(08).
PROCEDURE DIVISION.
0000-MAIN.
D DISPLAY "ENTRY INTO DVLDPGM".
MOVE 'YYYYMMDD' TO WS-FORMAT.
CALL 'CEEDAYS' USING
WS-INP-DATE,
WS-FORMAT,
WS-OUTPUT,
WS-FC-CODE.
DISPLAY 'FC-SEVERITY ' FC-SEVERITY.
IF FC-SEVERITY = 00
DISPLAY 'THE DATE IS A VALID DATE'
ELSE
DISPLAY 'THE DATE IS NOT A VALID DATE'
END-IF.
D DISPLAY "EXIT FROM DVLDPGM".
0000-MAIN-EXIT.
EXIT.
GOBACK.
OUTPUT
----------
********************************* TOP OF DATA **********************************
ENTRY INTO DVLDPGM
FC-SEVERITY 0003
THE DATE IS NOT A VALID DATE
EXIT FROM DVLDPGM
******************************** BOTTOM OF DATA ********************************
|
|
|
Back to top |
|
|
kolusu Site Admin
Joined: 26 Nov 2002 Posts: 12376 Topics: 75 Location: San Jose
|
Posted: Wed Oct 26, 2005 5:14 pm Post subject: |
|
|
shekar123,
The code looks fine for me. you should not have any problems with it. what is the value in FC-MESSAGE ?
Quote: |
Kolusu please tell me how do i avoid posting with spaces being concatinated as in this case my entire code is suppressed / spaces are padded up so that i can post properly from my next posts.
|
check this topic
http://www.mvsforums.com/helpboards/viewtopic.php?p=19031#19031
Kolusu _________________ Kolusu
www.linkedin.com/in/kolusu |
|
Back to top |
|
|
shekar123 Advanced
Joined: 22 Jul 2005 Posts: 528 Topics: 90 Location: Bangalore India
|
Posted: Wed Oct 26, 2005 5:27 pm Post subject: date validation pgm using LE calls |
|
|
Kolusu,
Code: |
I tried out displaying FC-MESSAGE and i am getting the the value as FC-MESSAGE 2518
WORKING-STORAGE SECTION.
01 WS-INP-DATE PIC 9(08) VALUE 20051027.
01 WS-OUTPUT PIC S9(9) COMP.
01 WS-FORMAT PIC X(08).
01 WS-FC-CODE.
05 FC-SEVERITY PIC S9(4) COMP.
05 FC-MESSAGE PIC S9(4) COMP.
05 FILLER PIC X(08).
PROCEDURE DIVISION.
0000-MAIN.
D DISPLAY "ENTRY INTO DVLDPGM".
MOVE 'YYYYMMDD' TO WS-FORMAT.
CALL 'CEEDAYS' USING
WS-INP-DATE,
WS-FORMAT,
WS-OUTPUT,
WS-FC-CODE.
DISPLAY 'FC-SEVERITY ' FC-SEVERITY.
DISPLAY 'FC-MESSAGE ' FC-MESSAGE.
IF FC-SEVERITY = 00
DISPLAY 'THE DATE IS A VALID DATE'
ELSE
DISPLAY 'THE DATE IS NOT A VALID DATE'
END-IF.
D DISPLAY "EXIT FROM DVLDPGM".
0000-MAIN-EXIT.
EXIT.
GOBACK.
********************************* TOP OF DATA **********************************
ENTRY INTO DVLDPGM
FC-SEVERITY 0003
FC-MESSAGE 2518
THE DATE IS NOT A VALID DATE
EXIT FROM DVLDPGM
******************************** BOTTOM OF DATA ********************************
|
|
|
Back to top |
|
|
kolusu Site Admin
Joined: 26 Nov 2002 Posts: 12376 Topics: 75 Location: San Jose
|
Posted: Wed Oct 26, 2005 5:33 pm Post subject: |
|
|
Quote: |
I tried out displaying FC-MESSAGE and i am getting the the value as FC-MESSAGE 2518
|
Shekhar123,
The message 2518 is caused by an invalid picture string(ws-format) was specified.
I ran the above code is as and I got 'THE DATE IS A VALID DATE' .
Are sure that you are looking at the right job output?
Kolusu _________________ Kolusu
www.linkedin.com/in/kolusu |
|
Back to top |
|
|
shekar123 Advanced
Joined: 22 Jul 2005 Posts: 528 Topics: 90 Location: Bangalore India
|
Posted: Thu Oct 27, 2005 5:47 am Post subject: date validation pgm using LE calls |
|
|
Kolusu,
I tried out displaying all the callable parameters after the CALL statement but still i am getting the same message as "DATE IS NOT VALID DATE'.How do we know the meaning of the message FC-MESSAGE 2518 and i am referening to the succesful run job execution output only.
Code: |
WORKING-STORAGE SECTION.
01 WS-INP-DATE PIC 9(08) VALUE 20051027.
01 WS-OUTPUT PIC S9(9) COMP.
01 WS-FORMAT PIC X(08).
01 WS-FC-CODE.
05 FC-SEVERITY PIC S9(4) COMP.
05 FC-MESSAGE PIC S9(4) COMP.
05 FILLER PIC X(08).
PROCEDURE DIVISION.
0000-MAIN.
D DISPLAY "ENTRY INTO DVLDPGM".
MOVE 'YYYYMMDD' TO WS-FORMAT.
CALL 'CEEDAYS' USING
WS-INP-DATE,
WS-FORMAT,
WS-OUTPUT,
WS-FC-CODE.
DISPLAY 'FC-SEVERITY ' FC-SEVERITY.
DISPLAY 'FC-MESSAGE ' FC-MESSAGE.
DISPLAY 'WS-INP-DATE ' WS-INP-DATE.
DISPLAY 'WS-FORMAT ' WS-FORMAT.
DISPLAY 'WS-OUTPUT ' WS-OUTPUT.
DISPLAY 'WS-FC-CODE ' WS-FC-CODE.
IF FC-SEVERITY = 00
DISPLAY 'THE DATE IS A VALID DATE'
ELSE
DISPLAY 'THE DATE IS NOT A VALID DATE'
END-IF.
D DISPLAY "EXIT FROM DVLDPGM".
0000-MAIN-EXIT.
EXIT.
GOBACK.
MESSAGE
-----------
ENTRY INTO DVLDPGM
FC-SEVERITY 0003
FC-MESSAGE 2518
WS-INP-DATE 20051027
WS-FORMAT YYYYMMDD
WS-OUTPUT 000000000
WS-FC-CODE O CEE
THE DATE IS NOT A VALID DATE
EXIT FROM DVLDPGM
|
|
|
Back to top |
|
|
kolusu Site Admin
Joined: 26 Nov 2002 Posts: 12376 Topics: 75 Location: San Jose
|
Posted: Thu Oct 27, 2005 7:12 am Post subject: |
|
|
Shekhar123,
I showed you how to post using code tags and you still keep posting without them and it is really hard to follow the code when posted without code tags.
As I said earlier, the code works fine for me . Here is the output
Code: |
FC-SEVERITY 0000
FC-MESSAGE 0000
WS-INP-DATE 20051027
WS-FORMAT YYYYMMDD
WS-OUTPUT 000154511
WS-FC-CODE
THE DATE IS A VALID DATE
|
Can you post your compile/Link-edit step output for me. please code tags when you post them.
Quote: |
How do we know the meaning of the message FC-MESSAGE 2518 and i am referening to the succesful run job execution output only.
|
Check this link and scroll to the bottom.
http://publibz.boulder.ibm.com/cgi-bin/bookmgr_OS390/BOOKS/CEEA3130/3.5.24?SHELF=&DT=20020625092930&CASE=
Hope this helps...
Cheers
Kolusu _________________ Kolusu
www.linkedin.com/in/kolusu |
|
Back to top |
|
|
shekar123 Advanced
Joined: 22 Jul 2005 Posts: 528 Topics: 90 Location: Bangalore India
|
Posted: Thu Oct 27, 2005 2:59 pm Post subject: date validation pgm using LE calls |
|
|
Kolusu,
I am enclosing the Compile step and the Link Step which are both successful but still i am not getting the desired output.My code remains the same and the output i get is :
Code: |
ENTRY INTO DVLDPGM
FC-SEVERITY 0003
FC-MESSAGE 2518
WS-INP-DATE 20051027
WS-FORMAT YYYYMMDD
WS-OUTPUT 000000000
WS-FC-CODE O CEE
THE DATE IS NOT A VALID DATE
EXIT FROM DVLDPGM
|
Code: |
//COBOL EXEC PGM=IGYCRCTL,REGION=640K,COND=(12,LE),
// PARM=('LIB,NOTERM,INTDATE(LILIAN)')
Invocation parameters:
LIB,NOTERM,INTDATE(LILIAN)
Options in effect:
NOADATA
ADV
NOANALYZE
QUOTE
NOAWO
BUFSIZE(4096)
NOCMPR2
NOCOMPILE(S)
NOCURRENCY
DATA(31)
NODATEPROC
NODBCS
NODECK
NODLL
NODUMP
NODYNAM
NOEXIT
NOEXPORTALL
NOFASTSRT
FLAG(I)
NOFLAGMIG
NOFLAGSTD
NOIDLGEN
INTDATE(LILIAN)
LANGUAGE(EN)
LIB
LINECOUNT(60)
NOLIST
NOMAP
NONAME
NONUMBER
NUMPROC(NOPFD)
OBJECT
NOOFFSET
NOOPTIMIZE
OUTDD(SYSOUT)
PGMNAME(COMPAT)
NORENT
RMODE(AUTO)
SEQUENCE
SIZE(MAX)
SOURCE
SPACE(1)
NOSSRANGE
NOTERM
NOTEST
TRUNC(STD)
NOTYPECHK
NOVBREF
NOWORD
NOXREF
YEARWINDOW(1900)
ZWB
//LINK EXEC PGM=IEWL,PARM='LIST,MAP,XREF',REGION=512K,COND=(4,LT)
BATCH EMULATOR JOB(TECH022C ) STEP(LINK ) PGM= IEWL
IEW2278I B352 INVOCATION PARAMETERS - LIST,MAP,XREF
PROCESSING OPTIONS:
ALIASES NO
ALIGN2 NO
AMODE UNSPECIFIED
CALL YES
CASE UPPER
COMPAT UNSPECIFIED
DCBS NO
DYNAM NO
EXTATTR UNSPECIFIED
EXITS: NONE
FILL NONE
GID UNSPECIFIED
HOBSET NO
LET 04
LINECT 060
LIST SUMMARY
LISTPRIV NO
MAP YES
MAXBLK 032760
MSGLEVEL 00
OVLY NO
PRINT YES
RES NO
REUSABILITY UNSPECIFIED
RMODE UNSPECIFIED
STORENX NO
TERM NO
UID UNSPECIFIED
UPCASE: NO
WKSPACE 000000K,000000K
XCAL NO
XREF YES
***END OF OPTIONS***
|
|
|
Back to top |
|
|
shekar123 Advanced
Joined: 22 Jul 2005 Posts: 528 Topics: 90 Location: Bangalore India
|
Posted: Thu Nov 03, 2005 3:46 pm Post subject: date validation pgm using LE calls |
|
|
Kolusu,
I am still getting the same error as "DATE IS NOT A VALID DATE".Can u please correct me if anything is wrong from my side / do i need to added anythimg else to get the desired output ?
PROGRAM
-----------
Code: |
WORKING-STORAGE SECTION.
01 WS-INP-DATE PIC 9(08) VALUE 20051027.
01 WS-OUTPUT PIC S9(9) COMP.
01 WS-FORMAT PIC X(08).
01 WS-FC-CODE.
05 FC-SEVERITY PIC S9(4) COMP.
05 FC-MESSAGE PIC S9(4) COMP.
05 FILLER PIC X(08).
PROCEDURE DIVISION.
0000-MAIN.
D DISPLAY "ENTRY INTO DVLDPGM".
MOVE 'YYYYMMDD' TO WS-FORMAT.
CALL 'CEEDAYS' USING
WS-INP-DATE,
WS-FORMAT,
WS-OUTPUT,
WS-FC-CODE.
DISPLAY 'FC-SEVERITY ' FC-SEVERITY.
DISPLAY 'FC-MESSAGE ' FC-MESSAGE.
DISPLAY 'WS-INP-DATE ' WS-INP-DATE.
DISPLAY 'WS-FORMAT ' WS-FORMAT.
DISPLAY 'WS-OUTPUT ' WS-OUTPUT.
DISPLAY 'WS-FC-CODE ' WS-FC-CODE.
IF FC-SEVERITY = 00
DISPLAY 'THE DATE IS A VALID DATE'
ELSE
DISPLAY 'THE DATE IS NOT A VALID DATE'
END-IF.
D DISPLAY "EXIT FROM DVLDPGM".
0000-MAIN-EXIT.
EXIT.
GOBACK.
|
OUTPUT
---------
Code: |
********************************* TOP OF DATA **********************************
ENTRY INTO DVLDPGM
FC-SEVERITY 0003
FC-MESSAGE 2518
WS-INP-DATE 20051027
WS-FORMAT YYYYMMDD
WS-OUTPUT 000000000
WS-FC-CODE O CEE
THE DATE IS NOT A VALID DATE
EXIT FROM DVLDPGM
******************************** BOTTOM OF DATA ********************************
|
_________________ Shekar
Grow Technically |
|
Back to top |
|
|
Bithead Advanced
Joined: 03 Jan 2003 Posts: 550 Topics: 23 Location: Michigan, USA
|
Posted: Thu Nov 03, 2005 4:11 pm Post subject: |
|
|
Try adding your LE run-time library (Probably CEE.SCEERUN) to your STEPLIB and re-run. See if that make a difference. |
|
Back to top |
|
|
shekar123 Advanced
Joined: 22 Jul 2005 Posts: 528 Topics: 90 Location: Bangalore India
|
Posted: Thu Nov 03, 2005 4:32 pm Post subject: date validation in COBOL |
|
|
Bithead,
I tried adding CEE.SCEERUN DD statement to my STEPLIB ,but i am still getting the same output.
Code: |
//STEPLIB DD DSN=TECH022.COBOL.LOADLIB,DISP=SHR
// DD DSN=CEE.SCEERUN,DISP=SHR
********************************* TOP OF DATA **********************************
ENTRY INTO DVLDPGM
FC-SEVERITY 0003
FC-MESSAGE 2518
WS-INP-DATE 20051027
WS-FORMAT YYYYMMDD
WS-OUTPUT 000000000
WS-FC-CODE O CEE
THE DATE IS NOT A VALID DATE
EXIT FROM DVLDPGM
******************************** BOTTOM OF DATA ********************************
|
_________________ Shekar
Grow Technically |
|
Back to top |
|
|
Bithead Advanced
Joined: 03 Jan 2003 Posts: 550 Topics: 23 Location: Michigan, USA
|
Posted: Thu Nov 03, 2005 4:37 pm Post subject: |
|
|
Can you browse your load module and let me know how many CEEDAYS you find? I am trying to find if you are linking it in from somewhere. |
|
Back to top |
|
|
shekar123 Advanced
Joined: 22 Jul 2005 Posts: 528 Topics: 90 Location: Bangalore India
|
Posted: Thu Nov 03, 2005 4:48 pm Post subject: date validation in COBOL |
|
|
Bithead,
Thanks for your early replies.I do not have any member by name CEEDAYS in my load module PDS. _________________ Shekar
Grow Technically |
|
Back to top |
|
|
Bithead Advanced
Joined: 03 Jan 2003 Posts: 550 Topics: 23 Location: Michigan, USA
|
Posted: Thu Nov 03, 2005 4:50 pm Post subject: |
|
|
Look in the load module for DVLDPGM and count the occurances of CEEDAYS. |
|
Back to top |
|
|
|
|