Notes on Procedures

Examples of Procedures

The following procedure (stored in CFS.USERLIB , element L) allows the user to mark any of the displayed files/library elements with the Action Code X. After entering the command A (process Action), the marked files will be formatted and printed with the help of an ONXLIST Variable Action. The CFS procedure is called by entering DO L, or DO L,file. In the last case, the first positional parameter, file, will be assigned to the procedure variable &1.

*IF &1 = '' &1 = '#LIST.FRANK'
*SET TAB=%
ONXLIST &1
*WRITESYS 'Mark the files to be printed'
*ON %TERM CONTINUE
*DIA
U
NPFSTAT &1
%PD7S
* Print the created list on remote printer 7 with Space=E (PD7S)
U
* Display the selected list again.
RL

The following procedure tests if a Connection has already been opened under CFS to the UTM application TEST. If so, it switches to this Connection. If not, the procedure determines the next free Connection number, establishes the connection to TEST, and issues a KDCSIGN command.

*&N=0
.LOOP
*&XX='CON'&N
*IF &&XX = 'TEST' SKIP .CC
*&N=&N+1
*IF &N<10 SKIP .LOOP
*IF &NEXTCON = '' SKIP .NOFREECONN
OC&NEXTCON TEST,CFS1
KDCSIGN ......
*SKIP .END
*
.NOFREECONN
*WRITESYS 'All Connections occupied. TEST application cannot be opened'
*SKIP .END
*
.CC
CC&N
*
.END

The following BS2000 DO procedure searches all J-type elements (Job Control) in a PLAM library for the occurrence of the string '12132716' (LOGON password of a particular userid). The resulting records will be written to a SAM file. Next, the records are processed with EDT such that all instances of '12132716' are replaced by '884310'. The original library elements are updated with these new records with a CFS REWRITE command.

/PROC C,(&LIB=LMS.PROC,&PSWOLD='12132716',&PSWNEW='884310'),SUBDTA=&
/SYSFILE SYSDTA=(SYSCMD)
/SETSW ON=(1,4)
/EXEC CFS
*002 FILE=LMS &LIB;FCB=J;VAR=ON&FIND'&PSWOLD'=W #RESULT
AU
NQR
EDT,#RESULT
ON&:2-2:FIND'*'COPY TO (1) KEEP
ON&CA'&PSWOLD'T'&PSWNEW'
COPY &(1)
WRITE O
HALT
REWR #RESULT
END
/SETSW OFF=(1,4)
/ENDP