/* REXX */
PARSE SOURCE s1 s2 s3 s4 s5 s6 s7 s8 s9
thislib = s5
membr = "$MYDSN$"
prefix = sysvar('SYSPREF') /* tso profile prefix */
uid = sysvar('SYSUID') /* tso userid */
If prefix = '' then prefix = uid /* use uid if null prefix */
If prefix <> '' & prefix <> uid then /* different prefix than uid */
prefix = prefix || '.' || uid /* use prefix.uid */
call S100_PDS_Get_Member
say " CYaBy..."
exit (0)
S100_PDS_Get_Member:
Address ISPEXEC
"LMINIT DATAID(MYDSNS) DATASET('"thislib"') ENQ(SHR)"
"LMOPEN DATAID("mydsns") option(input)"
"LMMFIND DATAID("mydsns") MEMBER("membr")"
if rc = 8 then /* member not there, so add it... */
do
Say "Member '"thislib"("membr")' is not there; creating... "
"LMMLIST DATAID("mydsns") OPTION(FREE)" /* free the list */
"LMCLOSE DATAID("mydsns")" /* close as input, reopen as output */
"LMFREE DATAID("mydsns")"
"LMINIT DATAID(MYDSNS) DATASET('"thislib"') ENQ(SHRW)"
"LMOPEN DATAID("mydsns") option(output)"
recdline = thislib
"LMPUT DATAID("mydsns") MODE(INVAR) ",
" DATALOC(recdline) DATALEN(80)"
"LMMADD DATAID("mydsns") MEMBER("membr") STATS(NO)"
"LMMLIST DATAID("mydsns") OPTION(FREE)" /* free the list */
"LMCLOSE DATAID("mydsns")" /* close as output, reopen as input*/
"LMFREE DATAID("mydsns")"
"LMINIT DATAID(MYDSNS) DATASET('"thislib"') ENQ(SHR)"
"LMOPEN DATAID("mydsns") option(input)"
end
Call S200_Records_Get
"LMMLIST DATAID("mydsns") OPTION(FREE)" /* free the list */
"LMCLOSE DATAID("mydsns")"
"LMFREE DATAID("mydsns")"
Return
S200_Records_Get:
LM_GET = "LMGET DATAID("mydsns") mode(invar) dataloc(myrec) ",
" datalen(inlen) maxlen(080)"
do forever
LM_GET
if rc = 0 then
do
call S300_Record_Process
end
else
if rc = 8 then
do
/* say "LMGET EOF..." */
leave
end
else
do
say "LMGET bad RC = " rc
leave
end
end
Return
S300_Record_Process:
Return
PARSE SOURCE s1 s2 s3 s4 s5 s6 s7 s8 s9
thislib = s5
membr = "$MYDSN$"
prefix = sysvar('SYSPREF') /* tso profile prefix */
uid = sysvar('SYSUID') /* tso userid */
If prefix = '' then prefix = uid /* use uid if null prefix */
If prefix <> '' & prefix <> uid then /* different prefix than uid */
prefix = prefix || '.' || uid /* use prefix.uid */
call S100_PDS_Get_Member
say " CYaBy..."
exit (0)
S100_PDS_Get_Member:
Address ISPEXEC
"LMINIT DATAID(MYDSNS) DATASET('"thislib"') ENQ(SHR)"
"LMOPEN DATAID("mydsns") option(input)"
"LMMFIND DATAID("mydsns") MEMBER("membr")"
if rc = 8 then /* member not there, so add it... */
do
Say "Member '"thislib"("membr")' is not there; creating... "
"LMMLIST DATAID("mydsns") OPTION(FREE)" /* free the list */
"LMCLOSE DATAID("mydsns")" /* close as input, reopen as output */
"LMFREE DATAID("mydsns")"
"LMINIT DATAID(MYDSNS) DATASET('"thislib"') ENQ(SHRW)"
"LMOPEN DATAID("mydsns") option(output)"
recdline = thislib
"LMPUT DATAID("mydsns") MODE(INVAR) ",
" DATALOC(recdline) DATALEN(80)"
"LMMADD DATAID("mydsns") MEMBER("membr") STATS(NO)"
"LMMLIST DATAID("mydsns") OPTION(FREE)" /* free the list */
"LMCLOSE DATAID("mydsns")" /* close as output, reopen as input*/
"LMFREE DATAID("mydsns")"
"LMINIT DATAID(MYDSNS) DATASET('"thislib"') ENQ(SHR)"
"LMOPEN DATAID("mydsns") option(input)"
end
Call S200_Records_Get
"LMMLIST DATAID("mydsns") OPTION(FREE)" /* free the list */
"LMCLOSE DATAID("mydsns")"
"LMFREE DATAID("mydsns")"
Return
S200_Records_Get:
LM_GET = "LMGET DATAID("mydsns") mode(invar) dataloc(myrec) ",
" datalen(inlen) maxlen(080)"
do forever
LM_GET
if rc = 0 then
do
call S300_Record_Process
end
else
if rc = 8 then
do
/* say "LMGET EOF..." */
leave
end
else
do
say "LMGET bad RC = " rc
leave
end
end
Return
S300_Record_Process:
Return