Question & Answer
Question
How to code a script to delete. (SCI35854)
Cause
Answer
This is an unsupported example delete Script called $DELOK. We do not provide specific scripts!. Following is an example delete script that issues a DELETE for Successfully collected batches flags C & F and no flags (UNITED); Modify as necessary for local environment.
An Mget A/C script can call the $DELOK script. This script can be modified to include additional test for what ever precisions desired that are available on the LOCDIR command responses. REF User Guide PG 4-20.
i.e an MGET script issues the following after a Successful MGET command:
call $DELOK /* Sub-Routine to delete all successfully collected batches */
rc=result
if rc > 0 then say "Successfully collect batches deleted",
else say "NOT ALL Successfully collect batches were deleted-RC="rc
$DELOK
/* REXX - $DELOK - C:E Sample Called Script for FTP A/C MGET deletes
Illustrates how to use LOCDIR variables to Delete successfully
collected batches whose flags are C F & NOT(UNITED).
*/
DELOK:
deleteall = 0
"LOCSITE DIRFORM=MBOX_OS390" /* Set OS390 DIRFORM */
"LOCDIR" /* List local batches */
if hcrc > 0 then do
msg = "No batches found in mailbox:"
"USERLOG" msg
say msg
RETURN 4
end
putbnums = ""
do i = 1 to locdir.0;
rc = Parse_Locdir_mbox_Os390()
rc = Successfully_Collected()
if rc = 0 then do /* if collected successfully */
"DELETE " locdir.ubid.i
if lastrc > 200 then deletealll = 8 /* NOT all deletes successfull */
else putbnums = putbnums locdir.bnum.i
end
end
if putbnums <> "" then do
msg = "The following batch numbers were deleted " ,
"from remote system :" space(putbnums)
say msg
end
Return deleteall
/*************************** SUB ROUTINES **********************************/
/* TEST FOR collected batches whose flags are C F & NOT(UNITED) */
Successfully_Collected:
if (locdir.C.i = "C" & locdir.F.i = "F" & locdir.I.i = " " & ,
locdir.U.i = " " & locdir.N.i = " " & locdir.T.i = " " & ,
locdir.E.i = " " & locdir.D.i = " ") then return 0
return 4
/* Parse the LOCDIR response lines & Stat flags */
Parse_Locdir_mbox_Os390:
parse var locdir.i ,
1 locdir.mid.i +8 ,
+2 locdir.bnum.i +7 ,
+4 locdir.byte.i +8 ,
+5 locdir.ubid.i +24 ,
+1 locdir.time.i +4 ,
+1 locdir.date.i +5 ,
+1 locdir.flgs.i +20 ,
+1 locdir.vbq.i +5 ,
+1 locdir.stat.i
parse var locdir.flgs.i , /* ref: User's guide p 4-20 */
1 locdir.I.i +1 ,
2 locdir.C.i +1 ,
3 locdir.D.i +1 ,
4 locdir.N.i +1 ,
5 locdir.U.i +1 ,
6 locdir.R.i +1 ,
7 locdir.T.i +1 ,
8 locdir.E.i +1 ,
9 locdir.M.i +1 ,
10 locdir.X.i +1 ,
11 locdir.F.i +1
/* Diagnostics: Say each variable *
say "locdir.mid.i =|"locdir.mid.i"|"
say "locdir.bnum.i =|"locdir.bnum.i"|"
say "locdir.byte.i =|"locdir.byte.i"|"
say "locdir.ubid.i =|"locdir.ubid.i"|"
say "locdir.time.i =|"locdir.time.i"|"
say "locdir.date.i =|"locdir.date.i"|"
say "locdir.flgs.i =|"locdir.flgs.i"|"
say "locdir.vbq.i =|"locdir.vbq.i"|"
say "locdir.stat.i =|"locdir.stat.i"|"
* <== rem the slash AST to show diagnostics*/ <BR>return 0
Historical Number
PRI11680
Product Synonym
[<p><b>]Fact[</b><p>];CONNECT:Enterprise OS/390 RDX, Release 1.2.00 [<br/>] SCI35854;[<p><b>]Goal[</b><p>];FAQ: How to code a script to delete.
Was this topic helpful?
Document Information
Modified date:
17 December 2019
UID
swg21525103