Ü
WRKQRY
·
It acts as a query builder
where we can make our query based on the options provided.
·
It is used to access
records of selected format of selected member of a file and to save the
selected query result in a query file.
·
Once the query is saved
we can change it, display the result of it and also can copy it.
Below is the File CUST for
which we will see how to make use of WRKQRY.
Work with Members Using PDM USALID09
File . . . . . . CUST
Library . . . . AMIT Position to . . . . .
Type options, press Enter.
3=Copy 4=Delete 5=Display 7=Rename 8=Display description
9=Save 13=Change text 18=Change using DFU 25=Find string ...
Opt Member Date Text
CUST 07/27/12
MBR2 07/23/12
MBR3 07/23/12
Bottom
Parameters or command
===>
F3=Exit F4=Prompt F5=Refresh F6=Create
F9=Retrieve F10=Command entry F23=More options F24=More keys
Type
WRKQRY è PRESS ENTER è Give the
query name
Work with Queries
Type choices, press Enter.
Option . . . . . . 1 1=Create, 2=Change, 3=Copy, 4=Delete
5=Display, 6=Print definition
8=Run in batch, 9=Run
Query . . . . . . . QRY1 Name, F4 for list
Library . . . . . QTEMP Name, *LIBL, F4 for list
F3=Exit F4=Prompt F5=Refresh F12=Cancel
Once we press Enter, we find
the below options to build the query.
Define the Query
Query . . . . . . : QRY1 Option . . . . . : CREATE
Library . . . . : QTEMP CCSID . . . . . . : 37
Type options, press Enter. Press F21 to select all.
1=Select
Opt Query Definition Option
1 Specify file selections
Define result fields
Select and sequence fields
Select records
Select sort fields
Select collating sequence
Specify report column formatting
Select report summary functions
Define report breaks
Select output type and output form
Specify processing options
F3=Exit F5=Report F12=Cancel
F13=Layout F18=Files F21=Select all
Press
Enter to get the screen below.
Specify File Selections
Type choices, press Enter. Press F9 to specify an additional
file selection.
File . . . . . . . . . CUST Name, F4 for list
Library . . . . . . AMIT Name, *LIBL, F4 for list
Member . . . . . . . . *FIRST Name, *FIRST, F4 for list <<< We can select any member
Format . . . . . . . . *FIRST Name, *FIRST, F4 for list <<< We can select any format
F3=Exit F4=Prompt F5=Report F9=Add file
F12=Cancel F13=Layout F24=More keys
Press
Enter to get the screen below.
Specify File Selections
Type choices, press Enter. Press F9 to specify an additional
file selection.
File . . . . . . . . . CUST Name, F4 for list
Library . . . . . . AMIT Name, *LIBL, F4 for list
Member . . . . . . . . MBR2 Name, *FIRST, F4 for list
Format . . . . . . . . CUSTR Name, *FIRST, F4 for list
F3=Exit F4=Prompt F5=Report F9=Add file
F12=Cancel F13=Layout F24=More keys
Select file(s), or press Enter to confirm. <<<<<<<<<<<<<<<<<<<<<
Press
Enter to get the screen below.
Define the Query
Query . . . . . . : QRY1 Option . . . . . : CREATE
Library . . . . : QTEMP CCSID . . . . . . : 37
Type options, press Enter. Press F21 to select all.
1=Select
Opt Query Definition Option
> Specify file selections
Define result fields
Select and sequence fields
Select records
Select sort fields
Select collating sequence
Specify report column formatting
Select report summary functions
Define report breaks
Select output type and output form
Specify processing options
F3=Exit F5=Report
F13=Layout F18=Files F21=Select all
Select options, or press F3 to save or run the query. <<<<<<<<<<<<<<<<
After
pressing F3, We get the below screen.
Exit this Query
Type choices, press Enter.
Save definition . . . Y Y=Yes, N=No
Run option . . . . . . 1 1=Run interactively
2=Run in batch
3=Do not run
For a saved definition:
Query . . . . . . . QRY1 Name
Library . . . . . QTEMP Name, F4 for list
Text . . . . . . . .
Authority . . . . . *LIBCRTAUT *LIBCRTAUT, authorization list name,
*CHANGE, *ALL, *EXCLUDE, *USE
F4=Prompt F5=Report F12=Cancel F13=Layout
F14=Define the query
Below
is the query result
Display Report
Query . . . : QTEMP/QRY1 Report width . . . . . : 43
Position to line . . . . . Shift to column . . . . . .
Line ....+....1....+....2....+....3....+....4...
CSNBR CSNAME CS#OPN CS$OPN
000001 100002 upi 0 .00
000002 100003 KUM 0 .00
****** ******** End of report ********