![]() |
Examples for CFS 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
The DO procedure described below creates a console that performs the following functions:
1) System dumps will be automatically answered with tsn.Y.
2) Those users logged on as TSOS or TT08 are allowed to enter any console command via a /TYPE CFSCON:/cmd or /TYPE CFSCON:tsn.xxxx command.
3) The DO procedure will be terminated by entering a /TYPE TERMINATE CONSOLE command.
/PROC N
/SYSFILE SYSDTA=(SYSCMD)
/SETSW ON=(1,4)
/EXEC $CFS.CFS
*002 FILE=NO
OC9$CONSOLE,,,R
xxxxx,C'sssss'
*ON %OUT=($CFS.CFS.PROCLIB(X/SRCITEM)) RESUME
CC9/STA MSG check if any messages are outstanding
*SKIP .SETTSN
.LOOP
*ON %OUT activate last *ON %OUT condition
CC9
.SETTSN
*&TEXT=%PTR(1,80) mark message text
*WRITE '&TEXT' display message text
*&TASK=%PTR(1,4)
*SKIP &SLABEL
.SYSDUMP
*WRITE '--------> &TASK..Y'
*SEND '&TASK..Y'
*SKIP .LOOP
.CFSCONSOLE
*IF %OUT=:1:'%' &TASK=%PTR(1,4)
*&VAR='USER-ID('&TASK.')'
*IF &&VAR='TSOS' SKIP .ALLOW-CONSINPUT
*IF &&VAR='TT08' SKIP .ALLOW-CONSINPUT
*WRITE '/MESS TSN=&TASK,USER-ID &&VAR. CONSOLE INPUT NOT ALLOWED'
*SEND '/MESS TSN=&TASK,USER-ID &&VAR. CONSOLE INPUT NOT ALLOWED'
*SKIP .LOOP
.ALLOW-CONSINPUT
*&TEXT2=&TEXT(1,50)
*WRITE 'COMMAND EXECUTED: &TEXT2'
*SEND '&TEXT'
*SEND '/MESS TSN=&TASK,COMMAND EXECUTED: &TEXT2'
*SKIP .LOOP
.EXIT
*ON %TIME=0 RETURN Return to the CFS command field
DC9
END Terminate CFS
/SETSW OFF=(1,4)
/ENDP
The conditions determining which console messages should act as a catalyst are stored in the element X/SRC ITEM in the $CFS.CFS.PROCLIB PLAM library. In this example, the element will have the following contents:
'SYSTEMDUMP DESIRED'+:1-20:'?' .SYSDUMP
'CFSCON:' .CFSCONSOLE
'TERMINATE CFSCONSOLE' .EXIT