Discussion:
A 'delete' problem
(too old to reply)
Graham Hobbs
2012-02-07 21:55:58 UTC
Permalink
Hello,
Am newish at mainframe rexx. When job reruns are necessary, I need my
z/OS REXX to ..
If file exists
delete it
create it
else
create it
end

.. but because I had troubles with 'delete' I stripped the REXX and
tried a simple ..

GRAND = "'"v_useridd"."v_fourlw".ZZJA5DEL'"
say 'I: GRAND='GRAND'='
say ' '

"ALLOC DDN(OUTFILE3) DSN("GRAND")"
say 'I: tried ALLOC RC='RC'='
"FREE DDN(OUTFILE3)"
say 'I: tried FREE RC='RC'='
"DELETE DDN(OUTFILE3)"
say 'I: tried DELETE RC='RC'='
exit

.. and got ..

I: GRAND='IBMUSE1.MFSY.ZZJA5DEL'=

I: tried ALLOC RC=0=
I: tried FREE RC=0=
IDC3901I ERROR QUALIFYING IBMUSE1.DDN
IDC3902I ** DEFAULT SERVICE ROUTINE ERROR CODE 20, LOCATE ERROR CODE 8
IDC0548I ** MEMBER OUTFILE3 NOT DELETED
IDC0014I LASTCC=8
I: tried DELETE RC=8=
***

.. since moving from PC to mainframe REXX, it seems I am not using
delete in the correct fashion (and I tried various ways. Might anyone
suggest something for the 'teeny tiny' if/else/end spec above? ..
especially 'how to delete a file'.
Am confused for sure - am reading delete has gone to idcams??
Please, thanks
Graham Hobbs

P.S> the file defined via JCL would be ..
//GRAND DD DSN=IBMUSE1.MFSY.ZZJA5DEL,DISP=(,CATLG,DELETE),
// UNIT=SYSDA,SPACE=(CYL,(1,1),RLSE),
// DCB=(LRECL=80,RECFM=FB)
Graham Hobbs
2012-02-07 22:23:41 UTC
Permalink
Post by Graham Hobbs
Hello,
Am newish at mainframe rexx. When job reruns are necessary, I need my
z/OS REXX to ..
If file exists
delete it
create it
else
create it
end
.. but because I had troubles with 'delete' I stripped the REXX and
tried a simple ..
GRAND = "'"v_useridd"."v_fourlw".ZZJA5DEL'"
say 'I: GRAND='GRAND'='
say ' '
"ALLOC DDN(OUTFILE3) DSN("GRAND")"
say 'I: tried ALLOC RC='RC'='
"FREE DDN(OUTFILE3)"
say 'I: tried FREE RC='RC'='
"DELETE DDN(OUTFILE3)"
say 'I: tried DELETE RC='RC'='
exit
.. and got ..
I: GRAND='IBMUSE1.MFSY.ZZJA5DEL'=
I: tried ALLOC RC=0=
I: tried FREE RC=0=
IDC3901I ERROR QUALIFYING IBMUSE1.DDN
IDC3902I ** DEFAULT SERVICE ROUTINE ERROR CODE 20, LOCATE ERROR CODE 8
IDC0548I ** MEMBER OUTFILE3 NOT DELETED
IDC0014I LASTCC=8
I: tried DELETE RC=8=
***
.. since moving from PC to mainframe REXX, it seems I am not using
delete in the correct fashion (and I tried various ways. Might anyone
suggest something for the 'teeny tiny' if/else/end spec above? ..
especially 'how to delete a file'.
Am confused for sure - am reading delete has gone to idcams??
Please, thanks
Graham Hobbs
P.S> the file defined via JCL would be ..
//GRAND DD DSN=IBMUSE1.MFSY.ZZJA5DEL,DISP=(,CATLG,DELETE),
// UNIT=SYSDA,SPACE=(CYL,(1,1),RLSE),
// DCB=(LRECL=80,RECFM=FB)
OK, found it .. google skills getting better!
Still interested in comments about the if/else/end structure.
Graham
Barry Schwarz
2012-02-08 19:08:50 UTC
Permalink
Post by Graham Hobbs
Post by Graham Hobbs
Hello,
Am newish at mainframe rexx. When job reruns are necessary, I need my
z/OS REXX to ..
If file exists
delete it
create it
else
create it
end
snip
Post by Graham Hobbs
OK, found it .. google skills getting better!
Still interested in comments about the if/else/end structure.
If the file exists and you execute
delete it
create it
you end up with a file containing only what your creation step put
into it. Your log should also shows a successful deletion.

If the file does not exist and you execute the same
delete it
create it
you end up with the same file containing only what your creation step
put into it. Your log should show unsuccessful deletion.

Since your log will be cluttered in either case, why bother with the
if-else? Of course the end has nothing to do with the if and else but
only with any DO statements used to allow multiple statements within
the range of the if or the else.
--
Remove del for email
Graham Hobbs
2012-02-08 22:02:37 UTC
Permalink
Post by Barry Schwarz
Post by Graham Hobbs
Post by Graham Hobbs
Hello,
Am newish at mainframe rexx. When job reruns are necessary, I need my
z/OS REXX to ..
If file exists
delete it
create it
else
create it
end
snip
Post by Graham Hobbs
OK, found it .. google skills getting better!
Still interested in comments about the if/else/end structure.
If the file exists and you execute
delete it
create it
you end up with a file containing only what your creation step put
into it. Your log should also shows a successful deletion.
If the file does not exist and you execute the same
delete it
create it
you end up with the same file containing only what your creation step
put into it. Your log should show unsuccessful deletion.
Since your log will be cluttered in either case, why bother with the
if-else? Of course the end has nothing to do with the if and else but
only with any DO statements used to allow multiple statements within
the range of the if or the else.
---
Is not the log I'm concerned with. The original post and the following
was/is just psuedocode (vaguely resembling REXX) just to describe the
objective. On the first execution of a job the 'else' condition
executes. Subsequent reruns cause the 'if' condition.

if use1.a.b exists
delete use1.a.b (because it has outofdate recs)
call open_writenewrecs_close
else
call open_writenewrecs_close
end
close use1.a.b
exit

..where

open_writenewrecs_close:
delete use1.a.b (because it has outofdate recs)
open use1.a.b
write todays rec 1
write todays rec 2
close use1.a.b
return

.. but as you say 'why bother with the if/else' so ended up with ..

call open_writenewrecs_close

.. i.e. delete it whether it exists or not! Was simple really:-) eh!
.. am slowing down:-(

Thanks for the realisation.
Graham
m***@si2m.fr
2016-12-05 17:30:28 UTC
Permalink
Le mardi 7 février 2012 22:55:58 UTC+1, Graham Hobbs a écrit :

Hello
i have the same error.
After ' enter ' the rest of my rexx procedure appears.
I share my procedure with a collegue.
When i was alone i did not have this message.
Sharing problem
--
------------------------------

SI2M - Siège Social : 21 rue Laffitte, 75317 PARIS Cedex 9 - RCS Paris : 478 042 831- Forme Juridique : GIE - SIREN/SIRET : 478 042 831 00030
Loading...