Page 1 of 1

To find month end dates

PostPosted: Wed Jul 28, 2010 5:12 pm
by jasand
Can you help me how to find the month end dates using COBOL pgm

Please let me know how to get the below requirement.
I need to manipulate the system run date and get last two month's end dates.

For eg: If today is June 1st or 3rd,
then the output file (FB/80) should hold 'May' and 'April' month end dates.

The output file should hold a single record as below,
ABCDEFGXX0000053110043010

where
ABCDEFG - constant
XX - a parm value (alphabetic) (Can we pass the parm value in the SORT JCL ?)
0000 - constant
053110 - date field (MMDDYY - May month's end date)
043010 - date field (MMDDYY - April month's end date)

Thanks.

Re: To find month end dates

PostPosted: Wed Jul 28, 2010 5:23 pm
by Robert Sample
To answer the easy question first:
XX - a parm value (alphabetic) (Can we pass the parm value in the SORT JCL ?)
If you are wanting to use PARM= on the sort step, certainly -- as long as you mean another job that will be submitted. If you mean the currently executing job, you need to be aware that once a job stream is submitted the JCL is fixed and cannot be changed by any executing process. If you mean to have a file read by SORT to pick up a parameter, you would need to post that in the appropriate sort forum for an answer.

As far as your requirement for month ending dates: do you not know how to code an IF or EVALUATE statement? If not, please go read the COBOL manual until you do understand both statements. If you do know how to code an IF or EVALUATE statement, why are you asking here instead of just coding it yourself? There is nothing tricky about the logic.