View previous topic :: View next topic
|
Author |
Message |
xknight
Active User
Joined: 22 Jan 2008 Posts: 117 Location: Liberty city
|
|
|
|
Hello Pals,
Objective of req is to check the GDG's last generation date, if the date is current date, i am returning RC of 15. Based on that, i have written my rexx code which works different when runs via TSO and JCL
Code: |
CURRDATE=0
CURRYEAR=0
FILEDATE=0
FILEYEAR=0
CNTR=0
I=0
/** PULL LVL **/
/** SAY 'LVL:' LVL **/
CALL GDG_FUNCTION
CALL CNTR_CHECK
EXIT
GDG_FUNCTION:
LVL="W635968.TEST.GDG(0)"
"ISPEXEC LMDINIT LISTID(TMPID) LEVEL("LVL")"
CURRDATE = DATE('DAYS')
CURRYEAR = SUBSTR(DATE('STANDARD'),1,4)
SAY 'CURTDATE' CURRDATE
SAY 'CURRYEAR' CURRYEAR
DO FOREVER
"ISPEXEC LMDLIST LISTID("TMPID") OPTION(LIST) DATASET(DSVAR) STATS(YES)"
IF RC = 0 THEN DO
SAY 'ZDLCDATE:' ZDLCDATE
FILEYEAR = SUBSTR(ZDLCDATE, 1,4)
FILEMON = SUBSTR(ZDLCDATE, 6,2)
FILEDATE = SUBSTR(ZDLCDATE, 9,2)
SAY 'FILEDATE:' FILEDATE
SAY 'FILEYEAR:' FILEYEAR
DATSAM = FILEYEAR||FILEMON||FILEDATE
DDX = DATE('D',DATSAM,'S')
SAY 'DDX:' DDX
IF CURRDATE = DDX & FILEYEAR = CURRYEAR
THEN
IF CURRDATE = DDX & FILEYEAR = CURRYEAR
THEN
CNTR=0
ELSE
CNTR=10
END
ELSE LEAVE
SAY 'CNTR:' CNTR
END
/*** CALL COUNTER CHECK FUNCTION ***/
CNTR_CHECK:
SAY 'CNTR2' CNTR
IF CNTR=10
THEN
EXIT 15 |
Problem is the logic works till checking the date, when i run via TSO, it clearly says CNTR value is 10, but when i run via JCL it says CNTR value is 0 and it returns RC = 0.
I couldnt simulate it to return RC = 15, when it has different creation date.
I have also tried using the
Code: |
ZISPFRC = Your_return_code
Address ISPEXEC "VPUT (ZISPFRC)", |
dint helped me either.
Is there anything to be taken care to get the RC = 15, Please advise. |
|
Back to top |
|
|
superk
Global Moderator
Joined: 26 Apr 2004 Posts: 4652 Location: Raleigh, NC, USA
|
|
|
|
A post of a run-time trace would be helpful. I suspect that your LMDLIST service is not executing successfully and the whole DO FOREVER code is being bypassed. |
|
Back to top |
|
|
xknight
Active User
Joined: 22 Jan 2008 Posts: 117 Location: Liberty city
|
|
|
|
Superk,
Quote: |
I suspect that your LMDLIST service is not executing successfully |
Thanks for the quick reply. I think you are correct, when i run via JCL, SAY statement which used in the DO FOREVER is not displayed in the SYSTSPRT. If that is the case, what shall be done.
PS: But when i run via TSO, SAY statement in DO FOREVER works fine and display exactly as it is.
Please suggest, since i have no deep knowledge on REXX, couldnt proceed it. |
|
Back to top |
|
|
superk
Global Moderator
Joined: 26 Apr 2004 Posts: 4652 Location: Raleigh, NC, USA
|
|
|
|
LMDINIT and LMDLIST are ISPF Services and require ISPF to be active in order for them to work. Try this exec as a test:
Code: |
/* REXX */
Parse Source s1 s2 s3 s4 s5 s6 s7 s8 .
If s8 = "ISPF" Then Say "ISPF is active"
Else Say "ISPF is not active. Environment is "s8
Exit 0
|
Now, run this exec in different environments and you'll get different results. Run it in batch (PGM=IRXJCL) and you'll get "ISPF is not active. Environment is MVS". Run it in TSO and you'll get "ISPF is not active. Environment is TSO/E". Run it in ISPF and you'll get "ISPF is active". Run it in batch TSO (PGM=IKJEFT01) and you'll get "ISPF is not active. Environment is TSO/E". Run in it batch ISPF (PGM=IKJEFT01 and ISPSTART command issued) and you'll get "ISPF is active". |
|
Back to top |
|
|
xknight
Active User
Joined: 22 Jan 2008 Posts: 117 Location: Liberty city
|
|
|
|
Quote: |
LMDINIT and LMDLIST are ISPF Services and require ISPF to be active in order for them to work |
Thanks for the information, helped me to understand better.
Yes as you suggested ran it TSO (6) option from ISPF - Message was ISPF ACTIVE, and when ran it thru TSO/BATCH - IKJEFT01 utility - Message was ISPF is not active. Environment is TSO/E.
Inorder to make it active, to run with IKJEFT01, any feasible solution is there. |
|
Back to top |
|
|
superk
Global Moderator
Joined: 26 Apr 2004 Posts: 4652 Location: Raleigh, NC, USA
|
|
|
|
A batch ISPF job step needs to have the following, as a minimum:
Code: |
//STEPNAME EXEC PGM=IKJEFT01,DYNAMNBR=128
//SYSPROC DD DISP=SHR,DSN=<your REXX library>
//ISPPLIB DD DISP=SHR,DSN=<your site's panel library>
//ISPSLIB DD DISP=SHR,DSN=<your site's skeleton library>
//ISPMLIB DD DISP=SHR,DSN=<your site's message library>
//ISPTLIB DD DISP=SHR,DSN=<your PROFILE library>
// DD DISP=SHR,DSN=<your site's table library>
//ISPPROF DD DISP=SHR,DSN=<your PROFILE library>
//ISPLIST DD SYSOUT=*,LRECL=121,BLKSIZE=1210,RECFM=FBA
//SYSTSPRT DD SYSOUT=*
//SYSTSIN DD *
PROFILE PREFIX(<your TSO user id>)
ISPSTART CMD(%<your REXX exec name>) NEWAPPL(ISR)
/*
|
|
|
Back to top |
|
|
xknight
Active User
Joined: 22 Jan 2008 Posts: 117 Location: Liberty city
|
|
|
|
Thank you very much for your time and information.
I have one last doubt, is this a normal way of REXX for executing on TSO Batch, to get the custom return code from REXX to JCL, Or Is there any util for rexx to make it possible. Just for learning purpose i am inquiring it.
Thanks, |
|
Back to top |
|
|
superk
Global Moderator
Joined: 26 Apr 2004 Posts: 4652 Location: Raleigh, NC, USA
|
|
|
|
If you write a REXX exec, and have it end with the statement:
EXIT <somevalue>
Then it WILL return that value back to the caller, whether it's the Terminal Monitor Program (TMP) IKJEFT01 or the REXX Interpreter (IRXJCL). When you involve ISPF, that changes things a bit sometimes. |
|
Back to top |
|
|
superk
Global Moderator
Joined: 26 Apr 2004 Posts: 4652 Location: Raleigh, NC, USA
|
|
|
|
After all of this, and notwithstanding the syntax errors your code contains, what exactly is supposed to be the purpose of your exec? Couldn't you have saved a lot of time and effort and used a simpler method, like using AMS (Access Method Services) or even the REXX built-in function LISTDSI? |
|
Back to top |
|
|
xknight
Active User
Joined: 22 Jan 2008 Posts: 117 Location: Liberty city
|
|
|
|
Quote: |
If you write a REXX exec, and have it end with the statement:
EXIT <somevalue> |
Yes kevin, i have also tested using IKJEFT01 (TSO Batch) EXIT instruction is working. However have noticed different RC thrown using PGM=(IKJEFT1A, IKJEFT1B & IKJEFT01)
Quote: |
what exactly is supposed to be the purpose of your exec? |
Purpose is to determine the latest GDG creation date, if the date is current date then RC 0 else RC 15 , so the subsequent steps based on RC, will resume.
Quote: |
Couldn't you have saved a lot of time and effort and used a simpler method, like using AMS (Access Method Services) or even the REXX built-in function LISTDSI? |
If i would have known, could have used. Thank u very much for info on LISTDSI function, now i have got some idea to resume the work and will make it simpler as u suggested |
|
Back to top |
|
|
xknight
Active User
Joined: 22 Jan 2008 Posts: 117 Location: Liberty city
|
|
|
|
Kevin,
Given Batch ISPF job step works like charm.
Code: |
//STEP01 EXEC PGM=IKJEFT01,DYNAMNBR=120
//ISPPROF DD DISP=SHR,DSN=W63.COPY.PROFILE
//ISPPLIB DD DISP=SHR,DSN=ISP.USER.ISPPLIB
// DD DISP=SHR,DSN=SYSL.TPM.DEVL.ISPPENU
//ISPMLIB DD DISP=SHR,DSN=ISP.USER.ISPMLIB
// DD DISP=SHR,DSN=ISP.SISPMENU
//ISPSLIB DD DISP=SHR,DSN=ISP.SISPSLIB
// DD DISP=SHR,DSN=ISP.SISPSENU
// DD DISP=SHR,DSN=ISP.USER.ISPSLIB
//ISPTLIB DD DISP=SHR,DSN=ISP.USER.ISPTLIB
// DD DISP=SHR,DSN=ISP.SISPTENU
//SYSPROC DD DISP=SHR,DSN=W635968.REXX.PDS
//SYSTSPRT DD SYSOUT=*
//SYSTSIN DD *
PROFILE PREFIX(W63)
ISPSTART CMD(%REXX2) NEWAPPL(ISR) |
Thanks for the good guidance |
|
Back to top |
|
|
enrico-sorichetti
Superior Member
Joined: 14 Mar 2007 Posts: 10886 Location: italy
|
|
|
|
Code: |
LVL="W635968.TEST.GDG(0)"
"ISPEXEC LMDINIT LISTID(TMPID) LEVEL("LVL")" |
show evidence that the two statement quoted provide valid results
anyway You are taking the <wrong> road ...
use BPXWDIN to get the latest GDG ..
YES, even if You are not aware of it, BPXWDYN accepts relative GDG specifications
and provides back the real name
ftp.software.ibm.com/s390/zos/tools/bpxwdyn/bpxwdyn.html
not the most recent one but useful enough
You might want to search the zOS manuals for the latest info starting from here
www-03.ibm.com/systems/z/os/zos/bkserv/index.html
after that You can use the real name to find out all You might want to kno about it
as an alternative You might use the realname rexx funtion
at Use [URL] BBCode for External Links file 183
or at gsf-soft.com/Freeware/
but beware about installing not authorized software on Your system |
|
Back to top |
|
|
xknight
Active User
Joined: 22 Jan 2008 Posts: 117 Location: Liberty city
|
|
|
|
Quote: |
show evidence that the two statement quoted provide valid results |
Below are the statements that am displaying in the REXX
Code: |
READY
PROFILE PREFIX(W635968)
READY
ISPSTART CMD(%REXX1) NEWAPPL(ISR)
CURTDATE 264
CURRYEAR 2011
ZDLCDATE: 2011/09/21
FILEDATE: 21
FILEYEAR: 2011
DDX: 264
CNTR: 0
NNTR2 0
W635968.D10A.SPFLOG1.LIST has been kept.
READY
END |
Quote: |
anyway You are taking the <wrong> road ...
use BPXWDIN to get the latest GDG .. |
I didnot aware of that.... thank you very much for directing me with the info
Quote: |
but beware about installing not authorized software on Your system |
Sure enrico.. |
|
Back to top |
|
|
enrico-sorichetti
Superior Member
Joined: 14 Mar 2007 Posts: 10886 Location: italy
|
|
|
|
Quote: |
Code: |
LVL="W635968.TEST.GDG(0)"
"ISPEXEC LMDINIT LISTID(TMPID) LEVEL("LVL")"
|
show evidence that the two statement quoted provide valid results
anyway You are taking the <wrong> road ... |
my bad
got curious and tested
ISPF resolving relative gdg generations ... GO FIGURE
disregard my comment about the wrongness
consider the other alternatives just as alternatives for different situations |
|
Back to top |
|
|
superk
Global Moderator
Joined: 26 Apr 2004 Posts: 4652 Location: Raleigh, NC, USA
|
|
|
|
enrico-sorichetti wrote: |
ISPF resolving relative gdg generations ... GO FIGURE
|
I don't know. Doesn't work on my system. |
|
Back to top |
|
|
enrico-sorichetti
Superior Member
Joined: 14 Mar 2007 Posts: 10886 Location: italy
|
|
|
|
here is the snippet I used to test
Code: |
EDIT ENRICO.ISPF.EXEC(LMD00) - 01.08 Columns 00001 00072
Command ===> Scroll ===> CSR
****** ***************************** Top of Data ******************************
000001 /*REXX - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - */
000002 /* */
000003 /* - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - */
000004 Trace "O"
000005
000006 Parse Source _sys _how _cmd .
000007
000008 parse arg gen
000009 gen = strip(gen)
000010 if gen = "" then ,
000011 gen = "ENRICO.TEST.GDG1(0)"
000012
000013 call $ispex "CONTROL ERRORS RETURN"
000014
000015 init_cmd = "LMDINIT LISTID(LIST) LEVEL("gen") "
000016 init_rc = $ispex(init_cmd)
000017 say init_rc
000018
000019 list_cmd = "LMDLIST LISTID("list") OPTION(LIST) DATASET(DSN) "
000020 do while ( $ispex(list_cmd) = 0 )
000021 say dsn
000022 end
000023
000024 free_cmd = "LMDLIST listid("list") OPTION(FREE) "
000025 free_rc = $ispex(free_cmd)
000026
000027 Exit
000028
000029 /* */
000030 $ispex:
000031 isp_0tr = trace("O")
000032 Address ISPEXEC arg(1)
000033 isp_0rc = rc
000034 trace value(isp_0tr)
000035 return isp_0rc
000036
000037 /* */
000038 $isred:
000039 isr_0tr = trace("O")
000040 Address ISREDIT arg(1)
000041 isr_0rc = rc
000042 trace value(isr_0tr)
000043 return isr_0rc
000044
000045 /* */
000046 $tsoex:
000047 tso_0tr = trace("O")
000048 Address TSO arg(1)
000049 tso_0rc = rc
000050 trace value(tso_0tr)
000051 return tso_0rc
000052
****** **************************** Bottom of Data ****************************
|
|
|
Back to top |
|
|
superk
Global Moderator
Joined: 26 Apr 2004 Posts: 4652 Location: Raleigh, NC, USA
|
|
|
|
Weird. I'm at z/OS V1R12 here. I get:
Code: |
Invalid data set level
Qualifiers cannot be longer than 8 characters.
Current dialog statement:
LMDINIT LISTID(tmpid) LEVEL(XXXXX.XXX.XXX.XXXXXXX(0))
|
|
|
Back to top |
|
|
enrico-sorichetti
Superior Member
Joined: 14 Mar 2007 Posts: 10886 Location: italy
|
|
|
|
even weirder I am testing on a 1.10
that odd
here is the model for the LMDINIT
Quote: |
****** ***************************** Top of Data ******************************
000001 'LMDINIT LISTID(LISTIDV) LEVEL('dslev') VOLUME('volser')'
=NOTE=
=NOTE= LMDINIT - Name of dialog service
=NOTE= LISTIDV - Name of the variable into which is stored the list-id
=NOTE= to be associated with the list of data set names.
=NOTE= DSLEV - Optional, data set name pattern which all data set
=NOTE= names in list must match
=NOTE= VOLSER - Optional, the volume on which data sets must reside in
=NOTE= order to be in the data set list.
=NOTE=
=NOTE= EXAMPLE: ADDRESS ISPEXEC
=NOTE= 'LMDINIT LISTID(DSLISTID) LEVEL(SYS1.ISP*) '
=NOTE=
000002 If rc ¬= 0 Then /* Return codes */
000003 Do /* 8 - Listid not created */
000004 End /* 12 - Invalid parameter value */
000005 Else /* 16 - Truncation or translation */
000006 /* error in accessing dialog */
000007 /* variables */
000008 /* 20 - Severe error */
. . . . . . . . . . . . . . . . . . . . . . . . . . .
|
the <LEVEL> is not a level in the LISTCAT sense,
it' s just a dataset pattern |
|
Back to top |
|
|
superk
Global Moderator
Joined: 26 Apr 2004 Posts: 4652 Location: Raleigh, NC, USA
|
|
|
|
I guess ISPF is adding up all of the characters, and if the last node, plus the open parentheses, the generation, and the close parentheses are no more than 8 characters, then it allows it as the level. |
|
Back to top |
|
|
xknight
Active User
Joined: 22 Jan 2008 Posts: 117 Location: Liberty city
|
|
|
|
Quote: |
consider the other alternatives just as alternatives for different situations |
Enrico,
Sure and thank you for info .. anyway it has enlightened me about new function. Day by day am learning more rexx |
|
Back to top |
|
|
|