Stop all related jobs that lock the specified file

Source: Internet
Author: User
Stop all related jobs that lock the specified file
Answer 1. Generate the CL command 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. Handling masterProgram
# 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_recognition [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;/ErrorCode/

*********************************
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_recognition, '', 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_asd, 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. Stop the CL program of the job.

*****************
Program: cldlt
Language: CL
*****************

PGM (& jobnam & usnam & jobnum)

*****************
Declare Section
*****************

DCL & jobnum char 6
DCL & usnam char 10
DCL & jobnam char 10
Monmsg cpf0000

*******************
Executable code
******************

Endjob job (& jobnum/& usnam/& jobnam) + option (immed)
Endpgm

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.