Specify Extraction Criteria

BATCH uses the variable and value you specify in the EXTRACT statement as criteria to select records. BATCH writes the records that you select to an extract file. You can use extraction criteria to extract users or profiles with a particular user ID, menu key, or another characteristic. 
tpxsm54
BATCH uses the variable and value you specify in the EXTRACT statement as criteria to select records. BATCH writes the records that you select to an extract file. You can use extraction criteria to extract users or profiles with a particular user ID, menu key, or another characteristic. 
2
Specify Masking Criteria Values
If you want to extract all records regardless of some of the values in your criteria, you can use masking characters as placeholders. You can mask any number of characters of the value from one to the number of characters in the value. You can change the masking value if it conflicts with values in the records. 
Example: Use a Mask to Extract User IDs
If you want to extract records for all users IDs that begin or end with specific characters, you can use masking criteria.
In this example, the EXTRACT statement produces the extract file named SALEDEPT. SALEDEPT contains the user records for all users whose user IDs begin with SALES, regardless of the last three characters:
EXTRACT GIVING(SALEDEPT) USER AND NO SESSIONS (UIDXNAME(SALES---))
Example: Change the Masking Character
Use the MASKCHAR parameter of the SET statement to specify a different masking character. The default masking character is a hyphen (-).
In this example, the SET statement sets the masking character as an exclamation point (!):
SET MASKCHAR '!'
Manage Errors
An error occurs when Batch finds a value in an input control record that contains the MASKCHAR value. The variable MASKERLV instructs Batch on how to handle the error. Use a SET statement to set MASKERLV to one of the following values:
  • 0
    Batch continues to process as if the error had not occurred. Error message TPBL1050 is issued.
  • 1
    (Default) Batch only processes records that do not contain the masking character. If the return code for the job is not already set to a higher number, the return code is set to 12. Error message TPBL1050 is issued. 
  • 2
    Batch terminates processing. All data before the error was encountered is saved. If the return code for the job is not set to a higher number, the return code is set to 16. 
  • 3
    No data is written to the extract file. User abend 930 is issued.
For example, set the return code as 2 to stop processing and save all data that was processed before the error. 
SET MASKERLV '2'
Specify Multiple Variables
If you want to extract all records that match multiple criteria, you can specify more than one variable in the extraction criteria.
For example, this statement extracts all user records that have a command class of A and an update class of A to the extract file PRIVUSRS.
EXTRACT GIVING(PRIVUSRS) USER AND NO SESSIONS (UIDXPRSV(A) UIDXUPDC(A))
Specify Multiple Values
If you want to extract records that match one or more of a set of values for a variable, you can specify more than one value in the extraction criteria.
For example, this statement produces an output file KEYUSERS that contains the user records for each user who has a menu key of PA1, PA2, or PA3:
EXTRACT GIVING(KEYUSERS) USER AND NO SESSIONS (UIDXMKEY(PA1 PA2 PA3))
A record must match only one of the specified criteria to be extracted.
Examples: Extract Records
  • As an administrator, you want to create an extract file to create a report or update records for all users with a particular value. 
    For example, this statement produces the output file PA2USERS that contains the user records for all users whose menu key is PA2. 
    EXTRACT GIVING(PA2USERS) USER AND NO SESSIONS (UIDXMKEY(PA2))
  • As an administrator, you want to create a report for a list of users and their sessions that the service department employees use. You also want to know what startup and termination ACL programs the users have assigned for their sessions. The user IDs for service department personnel begin with SERV, followed by a four-character code unique to the user
    For example, this statement produces an extract file SERVSESS that contains the merged user definitions and the associated session records for each user whose user ID begins with SERV.
    EXTRACT GIVING(SERVSESS) USER AND ALL SESSIONS (UIDXNAME(SERV----))
  • As an administrator, you want to write an ACL/E startup program for a session SALESREP. You want to create a report that lists all users who have the SALESREP session. For example, this statement produces an extract file SRUSERS. The extract file contains the user definition and the SALESREP session record for each user who has the SALESREP session.
    EXTRACT GIVING(SRUSERS) USER AND MATCHING SESSIONS (UENTUSER(SALESREP))
  • As an administrator you want to create a report that lists the profiles that give the user PASS access to the sessions. You also wants to know what sessions are associated with the profiles. For example, this statement produces an extract file PASSPROF that contains the profile definition and associated session records for each profile that has a value of PASS in the ACCESS field.
    EXTRACT GIVING(PASSPROF) PROFILE AND ALL SESSIONS (PIDXACCS(PASS))
  • As an administrator, you want to know what profiles have a session with a sessionID of TSO2. You also wants the report to list the startup and termination ACL/E programs that are assigned for the session by each profile. The statement produces an extract file TSO2PROF that contains the profile definition and TSO2 session records for each profile that has a session with a sessionID of TSO2.
    EXTRACT GIVING(TSO2PROF) PROFILE AND MATCHING SESSIONS (PENTUSER(TSO2))
    The records for sessions other than TSO2 are not included in the extract file.
  • As an administrator, you want to extract all mail locators for a user ID TUSR05, which has been deleted. For example, this statement creates the extract file OLDLOC, which contains all mail locators for the recipient TUSR05. The variable MLOCTO specifies the recipient of a mail message.
    EXTRACT GIVING(OLDLOC) MAILMESSAGE (MLOCTO(TUSR05))