Page 1 of 1

passing system date to program via proc

PostPosted: Fri Jul 11, 2008 5:21 pm
by supriya saraswat
i want to pass current date to my cobol program through jcl.how can i pass .

what will be the cobol prog and jcl for that.

can any one tell me...

Re: passing system date to program via proc

PostPosted: Fri Jul 11, 2008 7:20 pm
by Bill Dennis
You can use SORT program to write current date into a file and then read it into your program. Try running this:
//SORT     EXEC PGM=IERRCO00                 
//SYSOUT   DD SYSOUT=*                                 
//SORTIN   DD DUMMY,RECFM=FB,LRECL=80,BLKSIZE=80       
//SORTOUT  DD DISP=(,CATLG),DSN=yourid.DATECARD,       
//            UNIT=3390,SPACE=(TRK,1),VOL=SER=dasd   
//SYSIN    DD *                                       
 OPTION COPY                                           
 OUTFIL HEADER1=(DATENS=(MD4),TIME=(12.))             
//*                                                     

Re: passing system date to program via proc

PostPosted: Fri Jul 11, 2008 7:59 pm
by MrSpock
I'm curious to know why you'd want to pass a system date to a program when the program can just as easily retrieve the system date itself. What is the supposed advantage here?

Re: passing system date to program via proc

PostPosted: Mon Jul 14, 2008 11:34 am
by supriya saraswat
actually i got a program in which date for certain variables are fetched externally..i was unable to understand..
thats why....

Re: passing system date to program via proc

PostPosted: Fri Jul 18, 2008 1:39 pm
by jayind
Hi supriya saraswat,

actually i got a program in which date for certain variables are fetched externally..


if you can post the piece of code you are having difficulty to understand and respective JCL part, people will be able to help you..

Regards,
Jayind

Re: passing system date to program via proc

PostPosted: Tue Jul 22, 2008 6:30 pm
by supriya saraswat
Actually in the cobol program logic that processes date as an external parameter should be replaced with a logic that uses date from a system.

the problem is not with jcl...
so plz tell me what should be the logic???

Re: passing system date to program via proc

PostPosted: Wed Jul 23, 2008 4:25 pm
by jayind
Hi Supriya,

Since you have gone through the program, you understood how the date is handling currently.. we dont know how the date handled now and hence cant provide a solution until we see the piece of code handling the date currently. Looks like you have concern pasting the code in the forum, probably you can mask the values and change the variable names and make it as generic.

Regards,
jayind

Re: passing system date to program via proc

PostPosted: Thu Jul 24, 2008 2:19 am
by Bill Dennis
Are you changing the method simply because you don't understand the current logic?

Are you certain you always want the system date? What if you need to rerun yesterday's job?

Of course, all we can do is guess since the use of the date is not very well explained.