View previous topic :: View next topic |
Author |
Message |
bade_miya Beginner

Joined: 10 Dec 2003 Posts: 110 Topics: 38
|
Posted: Wed Mar 07, 2007 10:50 am Post subject: Debugging Rexx program which calls a cobol routine |
|
|
Hi All,
I am trying to call a cobol date routine from a Rexx program. The parameters passed to the cobol program are
1. Current date format (from 2nd position 3 byte long)
2. Current date
3. Date format to which convertion is to be done.
There are lots of other parameters in the copy book (including the output date) but we need to initialize them and pass the parameters.
For unknown reasons, the code is not working. The cobol code is in production in perfect working condition and hundreds of programs are accessing it. I also dont have access to the source code for the cobol program as it is handled by another team. I am assuming that there should be some problem with my Rexx. I used Trace command and no errors are displayed during execution. I dont know whether the cobol program is getting successfully called or not. Is there any way i can know this. I havent done much of rexx programing. I am attaching my rexx code below
Code: |
/* Rexx */
TODAYS_DATE = DATE('E')
TODAYS_DATE = STRIP(TODAYS_DATE)
SPACE_DUMMY = ' '
ZF_PARM = SUBSTR(SPACE_DUMMY,1,1) || 'GD ' || TODAYS_DATE || ' ' || 'DF9',
|| SUBSTR(SPACE_DUMMY,1,94)
SAY ZF_PARM
ADDRESS TSO
"ALLOC DD(SYSDBOUT) DSN(*) SHR REU"
"ALLOC DD(SYSOUT) DSN(*) SHR REU"
"CALL 'myid.pdsname(cobpgm)' 'ZF_PARM'"
SAY ZF_PARM
EXIT
|
Please can anyone help me in debugging the program and let me know how to get the return code back from the cobol program.
Thanks & Regards
bade_miya. |
|
Back to top |
|
 |
kolusu Site Admin

Joined: 26 Nov 2002 Posts: 12380 Topics: 75 Location: San Jose
|
Posted: Wed Mar 07, 2007 11:26 am Post subject: |
|
|
bade_miya,
When you run a COBOL program from a REXX exec, you need to be aware of the differences in the parameter list formats for using the different "address" options. When you use 'Address TSO' (the default) or 'Address ATTCHMVS', both program parameters and Language Environment run-time options are processed. When using 'Address LINKMVS', run-time options are not processed, but they are passed as program parameters to the COBOL program.
So change your call statement
Code: | ADDRESS LINKMVS "cobpgm ZF_PARM" |
Hope this helps...
Cheers
Kolusu _________________ Kolusu
www.linkedin.com/in/kolusu |
|
Back to top |
|
 |
Nic Clouston Advanced
Joined: 01 Feb 2007 Posts: 1075 Topics: 7 Location: At Home
|
Posted: Thu Mar 08, 2007 3:44 am Post subject: |
|
|
Why not use the Rexx Date(0 function to do the conversion for you? _________________ Utility and Program control cards are NOT, repeat NOT, JCL. |
|
Back to top |
|
 |
Nic Clouston Advanced
Joined: 01 Feb 2007 Posts: 1075 Topics: 7 Location: At Home
|
Posted: Thu Mar 08, 2007 3:45 am Post subject: |
|
|
Sorry - DATE() not date(0 - these early mornings! _________________ Utility and Program control cards are NOT, repeat NOT, JCL. |
|
Back to top |
|
 |
bade_miya Beginner

Joined: 10 Dec 2003 Posts: 110 Topics: 38
|
Posted: Thu Mar 08, 2007 8:39 am Post subject: |
|
|
Hi Kolusu, Nic
Thanks for your replies.
Kolusu, I tried your suggestion. but it returned the following error code while execution.
Code: |
GD 08/03/07 DF9
19 *-* ADDRESS LINKMVS "ZCDATERT ZF_PARM"
+++ RC(-3) +++
GD 08/03/07 DF9
***
|
The Rexx which i used is
Code: |
/**************************REXX**********************/
TODAYS_DATE = DATE('E')
TODAYS_DATE = STRIP(TODAYS_DATE)
SPACE_DUMMY = ' '
ZF_PARM = SUBSTR(SPACE_DUMMY,1,1) || 'GD ' || TODAYS_DATE || ' ' || 'DF9',
|| SUBSTR(SPACE_DUMMY,1,94)
SAY ZF_PARM
ADDRESS LINKMVS 'mypgm ZF_PARM'
SAY ZF_PARM
EXIT
|
I also tried changing the command to
Code: |
ADDRESS LINKMVS 'myloadlib(mypgm) ZF_PARM'
|
Any idea what could be wrong? What does RC -3 mean?
Nic, I have to change the date from dd/mm/yy format to DF9 format.
DF9 format is the 9's complement of total number of days from the year 1900. Todays DF9 date is 60851. I checked the Date() function before attempting this Rexx and found no conversion which will do this. Please let me know if there is any.
Thanks & Regards
bade_miya |
|
Back to top |
|
 |
Nic Clouston Advanced
Joined: 01 Feb 2007 Posts: 1075 Topics: 7 Location: At Home
|
Posted: Thu Mar 08, 2007 9:10 am Post subject: |
|
|
to get the days since 01/01/1900 is easy enough date(b) of 01/01/1900 subtracted from date(b) of today. By DF9 do you mean FIXED DECIMAL(9) (ie PACKED DECIMAL)? you can do that with a small routine. 9's complement - do not know. _________________ Utility and Program control cards are NOT, repeat NOT, JCL. |
|
Back to top |
|
 |
kolusu Site Admin

Joined: 26 Nov 2002 Posts: 12380 Topics: 75 Location: San Jose
|
Posted: Thu Mar 08, 2007 9:12 am Post subject: |
|
|
Quote: |
Any idea what could be wrong? What does RC -3 mean?
|
Check this link which explains about RC -3
bade_miya,
http://www.mvsforums.com/helpboards/viewtopic.php?p=31119#31119
Quote: |
Nic, I have to change the date from dd/mm/yy format to DF9 format.
DF9 format is the 9's complement of total number of days from the year 1900. Todays DF9 date is 60851. I checked the Date() function before attempting this Rexx and found no conversion which will do this. Please let me know if there is any.
|
Today's date is NOT 60851 away from 1900-01-01. It is only 39147 days away from 1900-01-01.
In rexx it is very easy to get what you are trying to do
Code: |
/* REXX */
CURRDATE = DATE('S') /*CCYYMMDD */
DAYS = DATE('B',CURRDATE, 'S') - DATE('B', '19000101', 'S')
SAY 'DAYS SINCE 1900-01-01 : ' DAYS
|
Hope this helps...
Cheers
Kolusu _________________ Kolusu
www.linkedin.com/in/kolusu |
|
Back to top |
|
 |
bade_miya Beginner

Joined: 10 Dec 2003 Posts: 110 Topics: 38
|
Posted: Thu Mar 08, 2007 10:23 am Post subject: |
|
|
Hi Nic, Kolusu
Thanks for your replies.
Nic, DF9 is a date format just like your mm/dd/yy format. To get this we will first find the number of days from the year 1900 which is 39148. Now we have to get the 9's complement of this. For getting 9's complement of any number just substract the number from as many 9's. In this example 9's complement of 39148 is 99999 - 39148 which is 60851. So the DF9 date for today is 60851.
Kolusu, Thanks for that Rexx code, Eventhough i didnt get the desired results, i tweeked the code to get the DF9 date. You are right, we are only 39147 days away from 1900-01-01. But we have to calculate the number of days from 1900 th year (which include 1900-01-01). So that makes it 39147 + 1 . I am submiting the Rexx code which i tweeked so that it might be useful for some one else in the future.
Code: |
/* REXX */
CURRDATE = DATE('S') /*CCYYMMDD */
DAYS = DATE('B',CURRDATE, 'S') - DATE('B', '19000101', 'S') + 1
SAY 'DAYS SINCE 1900-01-01 : ' DAYS
DAYS_NINES_COMP = 99999 - DAYS
SAY 'DF9 DATE IS : ' DAYS_NINES_COMP
|
I went through the link you provided, but couldnt find out what is really wrong with my Rexx program which is calling cobol. If i manage to solve that, i will post the correct Rexx here.
Thanks a lot for your help.
Thanks & Regards
bade_miya |
|
Back to top |
|
 |
bade_miya Beginner

Joined: 10 Dec 2003 Posts: 110 Topics: 38
|
Posted: Thu Mar 08, 2007 10:32 am Post subject: |
|
|
Hi Kolusu,
I was searching in the manuals to find what Date('B',Currdate, 's') does. Couldnt get it. What exactly does the parameters "B" and "S" stand for?
Thanks & Regards
bade_miya |
|
Back to top |
|
 |
Nic Clouston Advanced
Joined: 01 Feb 2007 Posts: 1075 Topics: 7 Location: At Home
|
Posted: Thu Mar 08, 2007 10:33 am Post subject: |
|
|
just to make it more unreadable you can skip the calculation of CURRDATE and use DATE(S) inside the the date function:
DATE('B',DATE('S'),'S') _________________ Utility and Program control cards are NOT, repeat NOT, JCL. |
|
Back to top |
|
 |
kolusu Site Admin

Joined: 26 Nov 2002 Posts: 12380 Topics: 75 Location: San Jose
|
Posted: Thu Mar 08, 2007 10:39 am Post subject: |
|
|
bade_miya wrote: | Hi Kolusu,
I was searching in the manuals to find what Date('B',Currdate, 's') does. Couldnt get it. What exactly does the parameters "B" and "S" stand for?
Thanks & Regards
bade_miya |
bademiya,
1. Click on "Quick Manuals" link on top of this page
2. Click on the manual "TSO/E REXX Reference" under REXX section
3. Read chapter 4.3.16 about date function which explains in detail
Hope this helps...
Cheers
Kolusu _________________ Kolusu
www.linkedin.com/in/kolusu |
|
Back to top |
|
 |
bade_miya Beginner

Joined: 10 Dec 2003 Posts: 110 Topics: 38
|
Posted: Thu Mar 08, 2007 11:27 am Post subject: |
|
|
Thanks Kolusu.  |
|
Back to top |
|
 |
|
|