停止锁住指定文件的所有相关作业
解答 1、生成CL命令DLTJOB
*******************************
CMD: DLTJOB
LANGUAGE: CL COMMAND SOURCE
*******************************
CMD PROMPT('DELETE JOBS LOCKING PF')
PARM KWD(OBJNAME) +
TYPE(QUAL1) +
MIN(1) +
PROMPT('OBJECT NAME:')
PARM KWD(MEMBER) +
TYPE(SNAME) +
LEN(10) +
MIN(1)
PROMPT('Object Member:')
QUAL1: QUAL TYPE(NAME) LEN(10) SPCVAL(ALL)
QUAL TYPE(NAME) LEN(10) SPCVAL(LIBL CURLIB ' ') +
PROMPT('Library Name:')
2、处理主程序
#include <string.h>
#include <stdio.h>
#include <qusec.h>
#include <qusgen.h>
#include <quscrtus.h>
#include <qusptrus.h>
#include <qusdltus.h>
#include <qmhsndm.h>
#include <qmhsndpm.h>
#include <qwclobjl.h>
#pragma linkage(CLDLT00,OS)
void CLDLT00 ( char job_name[10],
---------------char usr_name[10],
---------------char job_number[6] );
Qus_Generic_Header_0100_t space;
char list_section;
Qwc_OBJL0100_List_T entry_list;
***********************************
PARMS FOR CLDLT
***********************************
char job_nm[10]; / jobname/username/jobnumber /
char usr[10];
char job_nmbr[6];
**********************************
PARMS FOR QWCLOBJL
**********************************
char frmt[8];
char usr[10];
char qal_obj_name[20];
char obj_type[10];
char mem_name[10];
**********************************
PARMS FOR QUSCRTUS
**********************************
char spc_name[20];
char ext_atr[10];
int initial_size;
char initial_value[1];
char auth[10];
char desc[50];
char replace[10];
**********************************
MISCELLANEOUS VARIABLES
**********************************
int count;
int api_code;
Qus_EC_t err_code; /错误代码/
*********************************
START OF MAINLINE
*********************************
main(argc,argv)
int argc;
char argv[];
{
***************************************************************
Read in and assign the command-line arguments to respective
variables/
***************************************************************
strncpy(qal_obj_name,argv[1],20);
strncpy(mem_name,argv[2],10);
******************************************************
Assign value to specific variables in the program
******************************************************
strcpy(spc_name,"DLTOLDSPLFQTEMP ");
memset(ext_atr,' ',10);
initial_size = 1024;
strcpy(initial_value," ");
strcpy(auth,"CHANGE ");
memset(desc,' ',50);
strcpy(frmt,"OBJL0100");
strcpy(replace,"YES ");
strcpy(obj_type,"FILE ");
***********************************************
Call external program to create a user space
***********************************************
err_code.Bytes_Provided = 0;
api_code = 1;
QUSCRTUS(spc_name,ext_atr,initial_size,initial_value,auth,desc,replace,
&err_code);
********************************************************
Call external program to list job names into user space
********************************************************
api_code = 2;
QWCLOBJL(spc_name,frmt,qal_obj_name,obj_type,mem_name,&err_code);
**********************************************************
Call external program to get a pointer to the user space
and get addressability to the list data section.
**********************************************************
api_code = 3;
QUSPTRUS(spc_name,&space,&err_code);
list_section = (char )space;
list_section = list_section + space->Offset_List_Data;
entry_list = (Qwc_OBJL0100_List_T ) list_section;
count = 1;
*********************************************************
Loop through the entry list and delete old spooled files
*********************************************************
while (count <= space->Number_List_Entries) {
**********************************************************
Call external program to retrieve more spool information
**********************************************************
api_code = 4;
strncpy(job_nm,entry_list->Job_Name,10);
strncpy(job_nmbr,entry_list->Job_Number,6);
strncpy(usr,entry_list->Job_User_Name,10);
**************************
Delete the spooled file.
**************************
CLDLT00(job_nm,usr,job_nmbr);
count++;
entry_list++;
} /WHILE/
***********************
Remove the user space
***********************
api_code = 5;
QUSDLTUS(spc_name, &err_code);
}
3、停止作业的CL程序
*****************
PROGRAM: CLDLT
LANGUAGE: CL
*****************
PGM (&JOBNAM &USRNAM &JOBNUM)
*****************
DECLARE SECTION
*****************
DCL &JOBNUM CHAR 6
DCL &USRNAM CHAR 10
DCL &JOBNAM CHAR 10
MONMSG CPF0000
*******************
EXECUTABLE CODE
******************
ENDJOB JOB(&JOBNUM/&USRNAM/&JOBNAM) + OPTION(IMMED)
ENDPGM