Posted: Thu Nov 03, 2005 5:55 pm Post subject: date validation in COBOL
Kolusu,
I tried running the JCL as is but still the desired output is not coming.
Code:
********************************* TOP OF DATA **********************************
THE DATE IS NOT A VALID DATE
******************************** BOTTOM OF DATA ********************************
Joined: 26 Nov 2002 Posts: 12376 Topics: 75 Location: San Jose
Posted: Thu Nov 03, 2005 6:05 pm Post subject:
shekar123,
Did you make any changes in the JCL. If so list them .
Can you change the IF to the following
Code:
IF FC-SEVERITY = 00
DISPLAY 'THE DATE IS A VALID DATE'
ELSE
DISPLAY 'FC SEVERITY: ' FC-SEVERITY
DISPLAY 'FC MESSAGE : ' FC-MESSAGE
DISPLAY 'THE DATE IS NOT A VALID DATE'
END-IF
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 'FC SEVERITY: ' FC-SEVERITY
DISPLAY 'FC MESSAGE : ' FC-MESSAGE
DISPLAY 'THE DATE IS NOT A VALID DATE'
END-IF
GOBACK.
/*
//STEP0200 EXEC PGM=LOADER,
// PARM=('LIST,LET,XREF,DCBS,'),
// COND=(5,LT,STEP0100)
//SYSLIB DD DSN=CEE.SCEELKED,
// DISP=SHR
//SYSLIN DD DSNAME=*.STEP0100.SYSLIN,DISP=(OLD,DELETE)
//SYSLOUT DD SYSOUT=*
//SYSABOUT DD SYSOUT=*
//SYSDBOUT DD SYSOUT=*
//SYSUDUMP DD SYSOUT=*
OUTPUT
------
Code:
********************************* TOP OF DATA **********************************
FC SEVERITY: 0003
FC MESSAGE : 2518
THE DATE IS NOT A VALID DATE
******************************** BOTTOM OF DATA ********************************
Joined: 02 Dec 2002 Posts: 45 Topics: 1 Location: Sydney, NSW, Australia
Posted: Mon Mar 06, 2006 5:54 pm Post subject: CEEDAYS
I have found that you will get unpredictable results if you do not pass the first two parameters to CEEDAYS as varying length character strings. Using fixed length strings will work most of the time, but every now and again it seems to spit the dummy.
Refer to the Language Reference Manual Programming Reference for more info...
*************************************************
** SPECIFY INPUT DATE AND LENGTH **
*************************************************
MOVE 8 TO VSTRING-LENGTH OF WS-INP-DATE.
MOVE '20050231'
TO VSTRING-TEXT OF WS-INP-DATE.
*************************************************
** SPECIFY A PICTURE STRING THAT DESCRIBES **
** INPUT DATE, AND THE PICTURE STRING'S LENGTH.**
*************************************************
MOVE 85 TO VSTRING-LENGTH OF PICSTR.
MOVE 'YYYYMMDD'
TO VSTRING-TEXT OF PICSTR.
CALL 'CEEDAYS' USING
WS-INP-DATE,
PICSTR,
WS-OUTPUT,
WS-FC-CODE
DISPLAY 'WS-INP-DATE=>' WS-INP-DATE
DISPLAY 'PICSTR=>' PICSTR
DISPLAY 'WS-OUTPUT=>' WS-OUTPUT
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
GOBACK.
/*
//STEP0200 EXEC PGM=LOADER,
// PARM=('LIST,LET,XREF,DCBS,'),
// COND=(5,LT,STEP0100)
//SYSLIB DD DSN=SYS1.SCEELKED,
// DISP=SHR
//SYSLIN DD DSNAME=*.STEP0100.SYSLIN,DISP=(OLD,DELETE)
//SYSLOUT DD SYSOUT=*
//SYSABOUT DD SYSOUT=*
//SYSDBOUT DD SYSOUT=*
//SYSUDUMP DD SYSOUT=*
/*
//
Thanks,
Jaya. _________________ "Great spirits have always encountered violent opposition from mediocre minds."
-Albert Einstein
All times are GMT - 5 Hours Goto page Previous1, 2
Page 2 of 2
You cannot post new topics in this forum You cannot reply to topics in this forum You cannot edit your posts in this forum You cannot delete your posts in this forum You cannot vote in polls in this forum