PAN#1 Applications

This topic contains a series of sample problems and their solutions. Each problem introduces one or more features of the system. Library statements are introduced as they are needed. See  for the detailed syntax of user commands.
This topic contains a series of sample problems and their solutions. Each problem introduces one or more features of the
system. Library statements are introduced as they are needed. See PAN#1 Library Statements for the detailed syntax of
user commands.
Adding New Source Programs
The following exhibit adds a new source program, named PAY57, to the library.
++ID ... ++ADD PAY57,COBOL,SEQ "PAY57" Source Program  /*
The optional ID command permits job identification on a separate page. You can use it to identify the beginning of each major job within the PAN#1 input file.
The ADD command adds a new member, PAY57, to the library. You must assign a name to identify the source program stored on the library. If you use other optional parameters, other information is stored pertinent to the program you are adding. If you use the source language name, the program is formatted accordingly. In the previous exhibit, COBOL is the language chosen. The SEQ parameter causes the incoming program to be sequence checked. All sequence errors are shown in the print that is automatically generated when you use this parameter.
As output, you receive a printed list of your source program with any sequence errors noted. Your new program is then in the library with the following assigned attributes:
name .........................PAY57 internal description..........COBOL format .......................COBOL user code ....................0 level ........................001 status .......................TEST, ENABLE, and ACTIVE
Copying a Member Already in Library
The ++COPY command creates a new member by copying an existing member. The existing member must be in the library; the new member is automatically placed in the library. You only need to supply the name of the member you want to copy and the name you want to assign to the new member. The name of the new member can consist of any unique combination of up to ten alphanumeric characters. In the following exhibit, PAY57 is copied to PAY57T.
Source program PAY57 is in PRODuction status and needs to be modified. You cannot modify a PRODuction status program. You can, however, copy it; the copied version is given a slightly different name, in this case PAY57T. The copied version is written to the library in TEST status and can be modified.
As output from the run, you receive notification that the job was successfully completed and that a new member is added to the library. The new member is identical to PAY57, with two exceptions:
  • It has a different name (PAY57T)
  • It has a different status (TEST, ACTIVE, ENABLE).
Adding Records to Members in Library
The following exhibit adds records to a member already in the library. The new member, PAY57T, is now in the library and can be modified. You must insert two source statements between statements 48 and 49.
++UPDATE PAY57T,1 ++C 48       two statements /*
The ++UPDATE command identifies the member you want to change, PAY57T. One or more C (change) subcommands make the actual changes. You cannot update members that are in PRODuction or DISABLEd status. The level of the member is increased by one each time a ++UPDATE command is issued to the member and successfully completed. To update a member, you only need to supply the name and the current level of the member. In this case, the level number is 1. You can obtain the current level from any up-to-date list of the member. If you use the wrong level number, the program is not modified.
The ++C subcommand in the previous exhibit adds one or more consecutive records to a member after statement 48. You only need to supply the sequence number of the record after the record you want to insert.
Your output is printed notification that your job was successfully completed. You do not receive an up-to-date list of the altered program. To obtain this, you must either print a copy of the member using the WRITE command or compile the program.
Sample Uses of PAN#1 Commands
++ADD PAY61,COBOL,SEQ,120        IDENTIFICATION DIVISION.        PROGRAM-ID. 'PAY61'        ++INCLUDE ENVIR            |            |        STOP RUN. ++ADD ENVIR,COBOL,LIST        ENVIRONMENT DIVISION.            |            |        INPUT-OUTPUT SECTION. /*
The previous exhibit adds two programs to the
library. The first ++ADD adds member PAY61 with a COBOL format, lists the source input, sequence checks the appropriate columns, and gives this member a user code of 120. The second ++ADD adds a member called ENVIR with a COBOL format and lists the member (without sequence checking).
The UPDATE command in the previous exhibit modifies member PAY61, which must be at modification level one. The ++C subcommand indicates that the following source statement is inserted after sequence number 31. The updated member PAY61 is at level two upon successful completion.
++UPDATE PAY62,9 ++C 101,101 ++C 321,321     CLC WORK(2),=C'99'     BE ENDRTN
The UPDATE command in the previous exhibit modifies member PAY62, which is at level nine. The first ++C subcommand specifies that sequence line 101 is deleted. The second specifies that sequence line 321 is deleted and replaced with two new source statements. The updated member PAY62 is at level ten upon successful completion.
In the previous exhibit, the WRITE command followed by the PRINT parameter prints the member named PAY57 on the system print unit.
In the previous exhibit, the ++WRITE command followed by the WORK parameter and /* optional parameter writes the member PAY57 to a work file (tape or disk), followed by a /* delimiter.
++LEVEL PAY57,11,15 
The ++LEVEL command in the previous exhibit changes the level number of the member PAY57 from 11 to 15. The first parameter is the current level number of the member named on the
library. The second parameter is the new level number associated with the member.
The ++RENAME command in the previous exhibit changes the member name from PAY57TST1 to PAY57PROD. The member must now be referenced by the new name PAY57PROD. The name PAY57PROD must be unique.
In the previous exhibit, the ++SELECT command followed by the ++PRINT parameter selectively prints statements 1 through 135 of the member PAY57PROD at level 15. The level number must be the current level of the member named.
The ++COPY command in the previous exhibit creates a duplicate member of PAY57PROD named PAY57TST. The new name must be unique. The new member, PAY57TST, has a status of TEST, ACTIVE, ENABLE. PAY57TST can be modified.
The ++EJECT command in the previous exhibit advances the print form to the top of a new page. This command does not print on the output print unit.
The ID command in the previous exhibit advances the print form to the top of a new page, prints JOHN JONES PHONE X379 on a
identification page, then advances to the following page.
The ADD command in the previous exhibit formats the object module ABC by removing columns 73 through 80 and regenerating sequence numbers upon retrieval in columns 73 through 77. If you want to retain columns 73 through 80 in this case, code:
The previous exhibit replaces the entire member ABC with the following object module. For the update to be successful, the member must be at level 4. The updated member ABC is at level five upon successful completion. No listing of the input module is produced. If you want a list, you must use the WRITE command.
++USER ABC,360,370 
The previous exhibit changes the user code of member ABC from 360 to 370. You must always provide the current user code.
The previous exhibit places member ABC into an INACTIVE status. An INACTIVE status member is quite similar to a DISABLEd status member. PAN#2 can relocate it to a
protection file for temporary storage off-line. You can then restore it into the library at a future date.
The previous exhibit shows how to create or replace a user comment to member PAYTAX0022. This user comment appears on the directory listing.
++UPDATE PAY61A,10 ++C 2,(20,'PAY61A') ++C 31,(32,.)
In the previous exhibit, the UPDATE command modifies member PAY61A which is at level 10. The first ++C indicates that sequence line 2 is column updated by placing the eight character field 'PAY61A' (the quotes are part of the field) beginning in column 20. The second ++C performs a column update by placing a period in column 32 of sequence line 31. The updated member PAY61A is at level 11 upon successful completion.
In the previous exhibit, the WRITE command retrieves all members whose names begin with PAY to the system print unit. Each member begins listing at the top of a new page.
In the previous exhibit, the WRITE command with the * parameter retrieves all members on the library to the system punch file. The members are written in name sequence. Embedded INCLUDES are expanded or not expanded, as indicated by your system installation options. A single /* delimiter is written after the last record of the last member. If INCLUDEs are expanded, the usual reporting for the INCLUDEs appears on the print file.
++UPDATE PAY61A,11 ++D 27 ++R 28,40,/FILE-FD/FILE-NAME/
The update in the previous exhibit deletes statement 27 from the member PAY61A and replaces all occurrences of FILE-FD with FILE-NAME in statements 28 through 40. The
replacement update adjusts all characters to the right so that only the seven specified scan characters are deleted.
++RESEQ PAY57B,65,6,10,5
The previous exhibit inserts sequence numbers in positions 65 through 70 of each statement in member PAY57B. The first sequence number is 10 with each subsequent field being incremented by five.
The previous exhibit changes PAY57 to PL/I format specifications. All statement change level stamps are lost.
In the previous exhibit, the ADD command receives its input from a PDS described by the ddname DDN or a PLU described by SYSXXX. PDS or PLU member PROG1 is read as input for the ADD. Also, the ++UPDATE ALL receives its input from DDN or PLU on the OPTION INPUT command. Member PROG2 is read as input.
(z/OS only) In the previous exhibit, the members (PAY57,PAY58, and PAY59) are written as individual members to a PDS described by the ddname NEWPDS. The same result occurs with:
(z/OS only) Only one PDS member is created with:
(z/OS only) The PDS member has the name of NEWMEM.
++UPDATE NAME,1 ++C 2 DATA RECORD1 ++I 64 ++I 3,5,NAME2 ++C 5 ++I 8 ++I 19
The coding in the previous exhibit causes statement 64 of NAME, and statements 3 through 5 of NAME2 to be inserted after statement 2 of NAME, DATA RECORD1. After statement 5 of NAME, statements 8 and 19 of NAME are inserted.
The coding in the previous exhibit causes statements 3 through 62 of NAME2 to be inserted between DATA RECORD2 and DATA RECORD3. Member NAME is added with 63 records.
++UPDATE MEMBERA,1 ++D 8,18 ++I 33,72 ++R 19,,/ABC/DEF/ ++C 202 ++I 8,18 ++C 302,(8,NEWWORD) ++I 23,42,MEMBERB,32 ++D 303 ++I 1,,MEMBERB,32
The previous exhibit illustrates the following:
  • Statements 8 through 18 of MEMBERA are deleted and statements 33 through 72 of the same member are inserted in their place. 
  • The ABC data in statement 19 of MEMBERA is replaced with DEF data. 
  • Statements 8 through 18 of MEMBERA, which were previously deleted, are inserted after statement 202. This is possible because the old member is intact until the ++UPDATE is successfully completed. 
  • A column change is performed and statements 23 through 42 of MEMBERB, whose access code is 32, are inserted after the changed statement 302. 
  • Statement 303 is deleted and statement number 1 of MEMBERB is inserted in its place.
The previous exhibit defines a special type of member called a superset. No data is entered into the member with this command. Subsets are entered into this member with the ++ATTACH or ++COPY commands. All records entered are stored in DATA format.
The previous exhibit enters a subset called MONDAY into the superset called SUPDATA.
The previous exhibit enters a subset called TUESDAY in superset SUPDATA using the regular
member TUESDATA as input.
The sequence of commands in the previous exhibit shows how you can incorporate changes into a subset, since the ++UPDATE command is not valid with the superset subset structure. The first ++COPY creates a new
member called XTHURS from the subset THURSDAY. The original superset remains unchanged. The new member is created at level 1, is placed in TEST, ACTIVE, ENABLE status, and has the same language format as the originating superset. You can execute the UPDATE command against this new member since it is a regular
member, not a superset.
The --COPY replaces the subset called THURSDAY with the newly updated member called XTHURS, provided the UPDATE completed successfully. --COPY does not change the member XTHURS.