background image

Содержание 5280

Страница 1: ..._ 8L23 0032 1 File No 85280 24 Licensed Program IBM 5280 Distributed Data System COBOL Programmer s Guide Program Numbers 5708 CB1 OSIVS 5708 CB2 DOSIVSE...

Страница 2: ..._ SL23 0032 1 File No S52BO 24 Licensed Program IBM 5280 Distributed Data System COBOL Programmer s Guide Program Numbers 570B CB1 OS VS 570B CB2 DOS VSE...

Страница 3: ...that are not announced in your country Such references or information must not be construed to mean that IBM intends to announce such IBM products programming or services in your country Publications...

Страница 4: ...ing a COBOL program on the IBM 5280 You will need additional information that is to be found in IBM 5280 publications in for example the Message Manual A list of these manuals and their order numbers...

Страница 5: ...nd has the following information A summary of COBOL data communications capabilities The IBM 5280 facilities needed to execute a COBOL program The coding information necessary to write a data communic...

Страница 6: ...your program to another COBOL program or any other program for example a DE RPG program an assembler program a system utility program etc You achieve this linkage with a CALL to a COBOL library routi...

Страница 7: ...BM 5280 System Information IBM 5280 General Information GA21 9350 IBM 5280 Planning and Site Preparation Guide GA21 9351 IBM 5280 Master Index GA21 9356 IBM 5280 User s Setup Procedures GA21 9365 IBM...

Страница 8: ...Field Columns 1 through 5 2 11 Form Type Field Column 6 2 11 Name Type Field Column 17 2 11 Record Name Field Columns 19 through 26 2 11 Usage Field Column 38 2 11 Editing Field Columns 45 through 80...

Страница 9: ...SIGNC or SIGNF 7 10 DECK or NODECK D or NOD 7 10 FIPS or NOFIPS 7 11 viii IBM 5280 COBOL Programmer s Guide FLAG or NOFLAG 7 11 FI tISHFR R 7 11 GONUMBER or NOGONUMBER GN or NOGN 7 12 LINECOUNT n LC...

Страница 10: ...A 2 TTERM Routine A 3 TOPEN Routine A 3 TCLOZ Routine A 3 TREAD Routine A 4 TWRT Routine A 4 TCTL Routine A 5 Appendix B Status Key Return Codes B 1 Appendix C Compiler Limitations C I Appendix D Comp...

Страница 11: ...x IBM 5280 COBOL Programmer s Guide...

Страница 12: ...9 Figure 5 4 Statements used with sequential file organizations 5 11 Figure 5 5 Example of processing files with a sequential organization 5 13 Figure 5 6 Statements used with relative file organizat...

Страница 13: ...xii IBM 5280 COBOL Programmer s Guide...

Страница 14: ...examples of what you can do with the Data Definition Statements Define the layout of the screen the position of the fields that are to appear on the screen the data if any that is to appear in the fi...

Страница 15: ...nt field description statement s for each screen image entirely within one library text 4 If desirable enter sets of data definition statements for multiple screen images within the same library text...

Страница 16: ...Object Module 1 2 Arrange fields on the layout sheet order number GX21 9174 just as they will appear on the display screen Use the completed layout sheet as a guide for filling out the DDS coding she...

Страница 17: ...ts are given in detail in Chapter 2 3 Code the COBOL source program that is to read and write the screens Information on the COBOL statements that perform transaction I O is given in Chapter 3 4 Compi...

Страница 18: ...hen pressed cause the IBM 5280 system to take some action Command keys when pressed give control to your COBOL program A code showing which key was pressed is passed to a control area if specified in...

Страница 19: ...3 then pressing the desired command key The command keys as they appear on the data entry keyboard and the typewriter keyboard are shown in figures 1 3 and 1 4 The code passed to the program when each...

Страница 20: ...inking in the last line of the field and positions 15 and 16 of the Status Line contain 01 An awaiting record advance condition exists after the operator enters a character into the last position of a...

Страница 21: ...t an R appears in reverse image in position 23 in the status line at the top of the screen To stop automatic enter the operator again presses the Auto Enter key a blank will now appear in position 23...

Страница 22: ...between the cursor and the right end of the field moves to the right one position The operator can move the cursor within the field by using the Character Advance and Character Backspace keys After i...

Страница 23: ...he cursor moves to the next field where the operator can enter data If the edit finds an error a blinking error code will appear in positions 8 11 of the status line The cursor remains in the right mo...

Страница 24: ...ses any other edits you specify in the Data Definition Statements are done If no error is found the cursor advances to the next field in which the operator can enter data If an error is found a four d...

Страница 25: ...hrough F are the only valid entries The character displayed above the cursor is the single character that results from the translation of the hexadecimal value entered If the translation doesn t yield...

Страница 26: ...y stops the execution of the current program to load a program into another partition Then execution of the current program resumes If the new program is loaded into the same partition as the first pr...

Страница 27: ...1 14 IBM 5280 COBOL Programmer s Guide...

Страница 28: ...g the necessary Data Definition Statements The same Data Definition Statements are used in the COBOL coding example shown figure 3 3 in Chapter 3 For the purpose of the example it s assumed that data...

Страница 29: ...IBM Printer Display Layout form order number GX21 9174 as shown below International Bus s MachlnM Corporation PrinterIDisplay Layout POSITION Figure 2 2 PrinterjDisplay Layout form Using the layout fo...

Страница 30: ...step is to write the Data Definition Statements The IBM 5280 Data Description Specifications form order number GX21 9362 can be used as an aid in coding the specifications The data definition statemen...

Страница 31: ...SHIFT r uftJ SUB 1 SUeST Itabl ut TADOWTOTn TSU8 WTOTn I XCHKftabhindl 11 1 44 46 47 48 495051 52535455565758 5960 61 6263 64 65 66 67 68 69 70 7172 73 74 75 76 ie1 1111 1 5 1 fHI i I ItA 8Y PI In E R...

Страница 32: ...umeric In the example the Decimal Positions fields all contained blanks As shown in figure 2 4 this created alphanumeric X data items for all the fields D The Usage field column 38 This field defines...

Страница 33: ...0 i llp I IrRl1 ICI ll 141A D fI 411 f ft lslA In IU IT t I IA 1 7 111 IF IA In I TI t IA II 111X 18 MiF IA 11 1 IA 1234567 8 910111213141 51617181920212223 2425262728293031323334353637383940414243444...

Страница 34: ...ions l the operator must press the Field Exit key to go to the next field and 2 when the exit key is pressed all digits are shifted to the rightmost positions any unused positions to the left are fill...

Страница 35: ...d into one position of the field all positions must be filled If the operator attempts to exit the field without filling the positions with the characters specified in the Data Type field the keyboard...

Страница 36: ...e last character A secondary line must begin with a keyword A secondary line can have continuation lines under the same rules specified for primary lines Comment statements which contain an asterisk i...

Страница 37: ...See Continuation Characters earlier in this chapter Character constants consist of any combination of characters including blanks Character constants must be enclosed in apostrophes An apostrophe req...

Страница 38: ...name specified will appear as a 01 level record name and group item The rules for defining names are the same as for COBOL record names except for the limit of eight characters valid characters in the...

Страница 39: ...e Usage field define 02 level elementary items in the COBOL program 2 When a WRITE is executed any data in the associated record will be written to the screen You should therefore ensure that such fie...

Страница 40: ...utes specified by this keyword are combined with those specified in the field description statement if any to establish the display attributes to be used for a field See the explanation of DSPATR in t...

Страница 41: ...This page is intentionally left blank 2 14 IBM 5280 COBOL Programmer s Guide...

Страница 42: ...ith a boolean data item you code in your program For the rules to follow in coding the INDICATOR clause with a data item see the 5280 COBOL Language Reference manual under OCCURS Clause and INDICATOR...

Страница 43: ...ight adjusted Data Type Field Column 35 Leave this field blank when You code CHECK BY in the Editing field This statement defines a field that is to be used for output only the Usage field column 38 h...

Страница 44: ...eration is required on data entry keyboards N Numeric shift Any character can be entered The shift is positioned to the lower symbols on typewriter keyboards and is positioned to the upper symbols on...

Страница 45: ...y keyboards and the proof keyboards The shift cannot be changed by the operator A negative value is entered in the field when the operator having entered one or more digits presses the Field Exit Minu...

Страница 46: ...xplained later in this chapter 3 The operator can duplicate data from the corresponding positions in the preceding record by pressing the Duplicate key unless you specify CHECK DD 4 Data can be automa...

Страница 47: ...al line on the screen add the STARTING AT LINE value with the value you write in columns 39 41 Then subtract 1 2 If you don t specify a STARTING AT LINE clause the default value will be 3 3 The minimu...

Страница 48: ...ols whether or not duplication will occur with the Auto Dup Skip key as described in Chapter 1 During automatic duplication data type and CHECK keyword edits are ignored AS Automatic skip when the cur...

Страница 49: ...blank fill when the operator presses the Field Exit key all data is shifted from the position of the cursor to the rightmost positions of the field if no data has been entered in these positions The u...

Страница 50: ...the first position after a field the control characters do not appear on the screen Keep the following in mind when you code the Location field columns 39 44 1 The position immediately before and imme...

Страница 51: ...pt keyword allows you to display a prompting message on line 2 of the screen The prompt appears when the cursor enters the field The prompt is cleared when the cursor leaves the field The prompting me...

Страница 52: ...e shift positioned to the lower right symbols on the World Trade keyboards The operator can change the shift by using the shift keys tINote V and W should be used only for those keyboards with more th...

Страница 53: ...Usg Data Type Parameter Fld Field Entry Check Parameters Keywords I I S I I H I B Ip I L A A B B Y D F M M R R R 1M F 0 A C D H N S W X Y V C D S C y 1 R E E F B Z L IT T LC X X X I AD X X X X I AS X...

Страница 54: ...DDS that design the screen and edits the operator entries Summary of COBOL Transaction I O Statements This chapter will explain transaction I O using the example of the COBOL program in figure 3 2 The...

Страница 55: ...EN statement determines the availability of the file and if successful results in the file being in an OPEN mode You must always open the file with the 1 0 phrase as shown in figure 3 2 at m The WRITE...

Страница 56: ...ent WRITE is issued In the example shown in figure 3 2 READs are therefore coded at m III 1m II and m The STARTING AT LINE clause is optional Together with the location field you specify in the Data D...

Страница 57: ...ge is written at m m or IB all information on the lines that follow the message line are erased Therefore the screen with the original format is rewritten at BJ The CLOSE statement detaches the work s...

Страница 58: ...sed or was never opened then the EXCEPTION ERROR procedure is not executed COBOL will return a Status Key value of 92 The USE FOR DEBUGGING declarative coded before the EXCEPTION ERROR procedures and...

Страница 59: ...Data item Value returned Meaning TTYPE D Display SSIZE 1 1920 Characters 24 x 80 2 960 Characters 12 x 80 3 480 Characters 6 x 80 LOCATION L Local ON OFF LINE 0 Online ALLOC A Allocated to this progr...

Страница 60: ...ng one of the COBOL command keys See figures 1 3 and 1 4 in Chapter 1 for a description of these keys The program in the example shown in figure 3 2 checks the command key code at mafter each READ Tra...

Страница 61: ...ECTION FD SCREEN FILE PRJ LABEL RECORDS ARE OMITTED 01 SCREEN RECORD PIC X 88 FD 01 EMPMAS FILE VALUE OF OWNER ID IS BELL LABEL RECORDS ARE STANDARD COPY DDS EMPRECD EMPRECD 02 ACREC PIC X 00002 02 EM...

Страница 62: ...RK STATION DISPLAY ERROR ON WORK STATION I o DISPLAY FILE STATUS IS TUBE STAT DISPLAY RUN STOPPED STOP RUN a DISKETTE IO ERROR SECTION USE AFTER ERROR PROCEDURE ON EMPMAS FILE DISKETTE DISPLAY ERROR O...

Страница 63: ...OUS ENTRY IF AN ERROR WAS FOUND A MESSAGE IS WRITTEN AND THE PREVIOUS SCREEN REWRITTEN OTHERWISE WRITES A SCREEN IN WHICH THE OPERATOR CAN ENTER FRESH DATA IF INVALID EMPNO 1 WRITE SCREEN RECORD FROM...

Страница 64: ...ROR FOUND MOVE 0 TO CONTINUE ELSE MOVE A TO ACREC UPDATE MASTER MOVE SCREEN RECORD TO EMPRECD REWRITE EMPRECD INVALID KEY HI OPENS MOVE 1 TO INVALID EMPNO MOVE 0 TO CONTINUE OPEN 1 0 SCREEN FILE PR3 E...

Страница 65: ...o CITY STATE DSPATR CA 5D 05 11CHECK DR MF FE o ZIP CODE DSPATR CA 6D 06 11CHECK DR MF FE o BEGINNING DATE DSPATR CA 9D 07 11CHECK DR MF o SOCIAL SECURITY NUMBER DSPATR CA 1X 08 11CHECK DR MF o MARITA...

Страница 66: ...t valid 1 the program writes an error message to the screen indicating that the number entered isn t valid and 2 writes a screen format with the information previously entered The cursor bypasses the...

Страница 67: ...CORD CLEAR PIC X 65 EMPMAS FILE LABEL RECORDS ARE STANDARD COpy DDS INDIC EMPRECD 02 ENAME 02 STRAD 02 CTYST 02 EMPNO PIC X 00020 PIC X 00020 PIC X 00020 PIC X 00005 WORKING STORAGE SECTION II 01 IFIE...

Страница 68: ...WORK STATION READS IF INVALID EMPNO 1 WRITE SCREEN RECORD FROM ERRMSG1 FORMAT IS ERRMSG1 STARTING AT LINE 4 READ SCREEN FILE PR3 RECORD MOVE INDCATOR ON TO IFIELDS MOVE EMPRECD TO SCREEN RECORD WRITE...

Страница 69: ...FILE SCREEN FILE PR3 SET SWITCHES R EMPRECD ENAME STRAD CTYST EMPNO R ERRMSG1 MOVE 0 TO INVALID EMPNO STOP RUN ERROR FOUND MOVE TO CONTINUE DDS SOURCE LISTING B DSPATR CS UL 20X 01 11CHECK DR RB CHECK...

Страница 70: ...n you want to interact with an operator within one system and need to access data in a remote system When you want to process data online as it is received from the host When you want to match your 52...

Страница 71: ...environment A communications adapter When using SNA the elapsed time counter feature A partition with sufficient storage to run the COBOL program The amount of storage required by the program is prin...

Страница 72: ...Linkage Section of your program the detailed layouts of these areas are given in the routine descriptions that follow Communication Program Example Explanation Open Routine Figure 4 4 at the end of t...

Страница 73: ...a STOP statement as is shown at II in figure 4 4 to ensure the stations are connected For BSC a line connection with the remote station should be made immediately before the first READ or WRITE for S...

Страница 74: ...en transmit and receIve uperations is optional Any character F option assumed other than the above Figure 4 3 Options available with the Close routine An example of the statements used to call the Clo...

Страница 75: ...Data Division of your program in the following format 01 parameter 1 02 return code PIC 99 02 FILLER PIC 9999 02 record size PIC 9999 return code is a two digit completion code returned by the Write...

Страница 76: ...X 00020 02 STRAD PIC X 00020 02 CTYST PIC X 00020 02 ZIPCD PIC X OOOOS 02 BEGDT PIC X 00006 02 SOSNO PIC X 00009 02 MARST PIC X 00001 FD PRINT FILE LABEL RECORDS ARE STANDARD 01 PRINT RECORD OS RCDCD...

Страница 77: ...REMOTE STATION HIT ENTER IF COMM ERROR IS EQUAL TO 0 PERFORM REMOTE STATION WRITES UNTIL STOP WRITES IS EQUAL TO 1 IF COMM ERROR IS EQUAL TO 0 PERFORM CLOSE1 IF COMM ERROR IS EQUAL TO 0 DISPLAY RCOUN...

Страница 78: ...MOVE 1 TO COMM ERROR MOVE 1 TO CLOSE1 ERROR OPEN INPUT UPDATE FILE OUTPUT PRINT FILE Il I CLOSE2 CLOSE UPDATE FILE MOVE F TO CLOSE OPTION CALL AVCHCLOZ USING CLOSE PARAMS IF CRETURN CODE GREATER THAN...

Страница 79: ...4 10 IBM 5280 COBOL Programmer s Guide...

Страница 80: ...Some of these statements are The FILE CONTROL paragraph which relates your file to the diskette device and describes the access mode file organization and other factors relating to the file The OPEN...

Страница 81: ...th a relative organization according to their relative key For files with an indexed organization according to their record key In the example that follows the term current record pointer CRP is used...

Страница 82: ...ply to take the employee number and to subtract 999 to obtain the relative record number The file does not need to be created sequentially or read sequentially although either is quite possible Notice...

Страница 83: ...D Entry DISK tells COBOL that the device is a diskette You can optionally specify the following parameters device address1 is the physical address 4000 or 4400 for example or logical address of the de...

Страница 84: ...files refers to the use of a file by more than one program executing at the same time The ability of another program to use a file at the same time as your program depends on how the following COBOL l...

Страница 85: ...INPUT Figure 5 1 Valid combinations of SHARE SHARER and OPEN modes When a file is opened in the INPUT mode then only READ operations can take place When a file is opened in the 1 0 mode then depending...

Страница 86: ...he Status Line at the top of the screen A message identifier in the format 92nn will precede the message nn is the code that would have been placed in the Status Key had it been present See Appendix B...

Страница 87: ...D RUN STOPPED STOP RUN PRINT ERROR SECTION USE AFTER ERROR PROCEDURE ON PRINT FILE PRINTERX DISPLAY ERROR ON PRINTER FILE I O DURING WRITE DISPLAY FILE STATUS IS PRINT FILE STAT DISPLAY TRANSMISSION S...

Страница 88: ...onsiderations Figure 5 3 shows the actions taken for all the combinations of AT END INYALID KEY and EXCEPTION jERROR procedure based on the first digit of the Status Key tffNote the following The retu...

Страница 89: ...y the verb after the I O request 9 The verb after the I O The verb after the I O The verb after the The EXCEPTION Other errors request executes request executes INVALID KEY or AT ERROR procedure END c...

Страница 90: ...stem must have included ASCII support when it was installed The following guidelines apply in creating a file with a sequential organization 1 Use WRITEs to create a sequential file 2 Specify OUTPUT m...

Страница 91: ...the Utilities Reference Operations Manual For multivolume diskette OUTPUT files when end of volume is found the next volume is requested after the volume is mounted the WRITE is done COBOL will mark...

Страница 92: ...replaces the original record in I O FILE with INPUT RECORD IDENTIFICATION DIVISION PROGRAM ID UPDATE SEQUENTIAL ENVIRONMENT DIVISION CONFIGURATION SECTION SOURCE COMPUTER IBM 370 OBJECT COMPUTER IBM...

Страница 93: ...PUT OUT ERROR MESSAGE PERFORM ERROR OUT 1 DISPLAY INPUT RECORD UPON SCREEN MOVE SPACES TO DISP RECORD PERFORM READ INPUT GO TO UPDATE TEST LOOP CLOSE FILES CLOSE INPUT FILE I O FILE STOP RUN STOP RUN...

Страница 94: ...relative file organizations The following guidelines apply in creating a file with a relative organization 1 Use WRITE statements to create a relative file 2 Specify the OUTPUT mode in the correspondi...

Страница 95: ...ust written If the end of extent is reached when a WRITE request is executed an invalid key condition will occur setting the Status Key to 24 boundary error When issuing a WRITE with the random access...

Страница 96: ...COPY DDS EMPRECD 01 EMPRECD 02 ACREC PIC X 00002 02 EMPNO PIC S9 05 V 02 ENAME PIC X 00020 02 STRAD PIC X 00020 02 CTYST PIC X 00020 02 ZIPCD PIC X 00005 02 BEGDT PIC X 00006 02 SOSNO PIC X 00009 02 M...

Страница 97: ...with a relative organization 1 The file that is to be updated must have previously been created 2 Specify 1 0 mode in the corresponding OPEN Otherwise a logic error will occur on a subsequent READ WRI...

Страница 98: ...S V WORKING STORAGE SECTION 77 DISK STAT PIC XX VALUE SPACES 77 RKEY PIC 9999 VALUE ZERO DATA DIVISION OPEN I O EMPMAS FILE PR3 READ MASTER SUBTRACT 1000 FROM EMPNO GIVING RKEY READ EMPMAS FILE INVALI...

Страница 99: ...This page is intentionally left blank 5 20 IBM 5280 COBOL Programmer s Guide...

Страница 100: ...DELETE CLOSE Procedure Division For ACCESS IS RANDOM OPEN 1 0 READ WRITE REWRITE DELETE CLOSE Figure 5 9 Statements used with indexed file organizations COBOL supports two types of indexed files In on...

Страница 101: ...s in the FILE CONTROL section include the ORGANIZATION ACCESS MODE RECORD KEY RELATIVE KEY and FILE STATUS clauses They are described in the Language Reference Manual some are shown in the examples gi...

Страница 102: ...oded The in storage index isn t used when ACCESS IS SEQUENTIAL is in effect 3 By increasing the value nnnn performance may be improved because of less search time to find the desired record However yo...

Страница 103: ...cation records are placed in their associated data set in the order they are written Note When random access is used the records may be written in any order When sequential access is used they must be...

Страница 104: ...d of extent is reached on a WRITE request an invalid key condition occurs setting the Status Key to 24 for boundary error See Allocating Data Sets for Program Files in Chapter 8 for the rules that app...

Страница 105: ...STORAGE SECTION 77 STATUS KEY PIC X 2 77 XEMPNO PIC 9 5 PROCEDURE DIVISION BEGIN OPEN OUTPUT EMPMAS FILE MOVE SPACES TO EMPRECD MOVE F TO ACREC DISPLAY EMPLOYEE MASTER FILE WITH 1000 MASTER RECORDS B...

Страница 106: ...0 02 CTYST PIC XCOO020 02 ZIPCD PIC xCOOOOS 02 BEGDT PIC XCOOO06 02 SOSNO PIC XCOOO09 02 MARST PIC xC 0000 1 WORKING STORAGE SECTION 77 STATUS KEY PIC X 2 77 XEMPNO PIC 9CS PROCEDURE DIVISION BEGIN OP...

Страница 107: ...the best performance When updating only a few records in the entire file use the random access method 2 For sequential access updating is done by a REWRITE or DELETE always preceded by a READ 3 For ra...

Страница 108: ...E PICTURE X 20 05 FILLER PICTURE X 5 05 PRINT BAL PICTURE 99 05 FILLER PICTURE X 5 05 PRINT AMT PICTURE 99 05 FILLER PICTURE X 5 05 PRINT NEW BAL PICTURE 99 01 PRINT RECORD 2 PICTURE X 86 WORKING STOR...

Страница 109: ...SS 2 GO TO READ INPUT WRITE PARA 1 IF LINE COUNT 60 PERFORM PAGE END THROUGH PAGE START WRITE PRINT RECORD 1 ADD 1 TO LINE COUNT REWRITE DISK RECORD INVALID KEY GO TO CHK ERR CHK ERR IF SK NOT 00 MOVE...

Страница 110: ...re guidelines and rules for specifying I O statements that are to transmit data to 5280 printers 1 The format of the FILE CONTROL paragraph is as follows SELECT file name ASSIGN TO PRINTER device addr...

Страница 111: ...R ERROR PROCEDURE ON PRINT FILE PRINTERX END DISPLAY ERROR ON PRINTER FILE Ilo DURING WRITE DISPLAY FILE STATUS IS PRINT FILE STAT DISPLAY TRANSMISSION STOPPED RUN STOPPED STOP RUN DECLARATIVES OPEN O...

Страница 112: ...in your program either implicitly or explicitly the operator can re direct the DISPLAY transmission to the work station screen when the COBOL program is loaded 5 If you specify the work station screen...

Страница 113: ...less than 78 bytes the right most bytes will be padded with blanks 3 Specify OUTPUT mode in the OPEN statement for the file defined for the work station 4 If a sequential file and a transaction file a...

Страница 114: ...UT SECTION FILE CONTROL SELECT IN FILE ASSIGN TO WORKSTATION 1920 SELECT PRINT FILE ASSIGN TO WORKSTATION 1920 SELECT CLEAR FILE ASSIGN WORKSTATION 1920 DATA DIVISION FILE SECTION FD CLEAR FILE LABEL...

Страница 115: ...REC GO TO ECHO 1 WRAP IT UP CLOSE IN FILE PERFORM CLEAR WRITE CLOSE PRINT FILE END IT DISPLAY END PROGRAM ECHO STOP RUN Figure 6 3 Example of statements used for sequential I O to a work station Part...

Страница 116: ...itor is not used for IBM 5280 COBOL The host compiler produces object modules ready for execution on the 5280 A linkage editing step between compilation and execution is neither necessary nor possible...

Страница 117: ...This page is intentionally left blank 7 2 IBM 5280 COBOL Programmer s Guide...

Страница 118: ...ta set B SYSLIB defines the COpy library which contains source statements and data definitions statements DDS you can insert into a source program using COpy This statement isn t required when compili...

Страница 119: ...P SHR BllcOB SYSLDOUT DD DSN LOADLIB PROGA DISP OLD allcOB SYSIN DD DSN SORCELIB PROGA DISP SHR II Figure 7 3 Example of using a COBOL compile procedure II CBJOB causes the compile procedure named AVC...

Страница 120: ...OS VSE compilation The following text describes the statements in figure 7 4 II SYS001 through SYS005 are utility data sets used by the compiler during execution All work files must be on the same dev...

Страница 121: ...ge Requirements The compiler requires a 144K partition with an additional24K bytes of GETVIS space See Appendix F for estimates on the main and secondary storage required for the compiler and the vari...

Страница 122: ...statement An option specified in a PROCESS statement will override the defaults set by IBM and the options if any you specify in the job control statements of the host system When Using Subprogram Lin...

Страница 123: ...ore blanks or both The option keywords can appear in any order 5 The statement should be followed by a period 6 The PROCESS statement with or without options causes a separate compilation for the sour...

Страница 124: ...defaults is shown in figure 7 5 a detailed explanation of each option is given in the sections that follow 2 For OSjVS by specifying the option in the PARM statement of the EXEC statement as describe...

Страница 125: ...MT XREF I NOXREF XINOX NOXREF Figure 7 5 List of options available at compilation CMPAT SIGNC or CMPAT SIGNF CM SIGNC or CM SIGNF The CMPAT option determines whether a C or an F will be generated as t...

Страница 126: ...0 That is the program cannot later be copied or reformatted to a different record length Also a program created with NODECK can only reside in data sets having a record length of 128 When you specify...

Страница 127: ...d or the statement numbers assigned by the compiler as determined by the STMT or NUMBER option described later in this chapter NOGONUMBER is the default LINECOUNT n LC n LIST or NOLIST MAP or NOMAP Wi...

Страница 128: ...evel 01 02 03 etc of the data item II SOURCE NAME Name of data item II LNTH Storage length in bytes of the data item EI AREA Defines the area in which the data has been allocated as follows F File Con...

Страница 129: ...OPTN or NOOPTN PRINT or NOPRINT PROMPT or NOPROMPT When OPTIONS the default is in effect the assembler will print a list of all the options in effect for the compilation both the options you explicit...

Страница 130: ...the COBOL object program to the operator at the 5280 data station These prompts appear on the screen when the program is loaded and are described in Chapter 8 If you don t specify a RUNMSG option the...

Страница 131: ...DRGANIZATIO IS HELATI E ACCESS NODE IS SEGUENTIAL RELATIVE KEY IS RKEY FILE STAT S IS STATUS KEY DATA 01 V IS ION FILE SECTICh FO EMPMAS FILE OOOCOI 01 000002 00000 C00006 000008 000010 000012 000016...

Страница 132: ...AS C CITY STATE DSPATlHCA llPCC 5 05 llCHECKCOR MF FE C ZIP CODE OSPATRCCA SEGel t o 06 lICHECK AO DR MF FE C EEGINNING DATE OSPATR CA SOSNC 90 01 lICHECK OR MF FE C SCCIAL SECURITY NUMBEf l OSPATf l...

Страница 133: ...3 46 1 ALFHANUM 21 30 PARANAME 40 51 31 P af A AfIIE 43 E 24 Al PHA UM 27 2t N MERIC 30 14 44 48 13 EMPo AME 11 23 ALFHANUM 26 2 ALPt1A UM 29 14 50 lCi lLPt1ANUM 22 21 ALFt1A UM 24 Figure 7 10 Sample...

Страница 134: ...he program executes The individuals responsible for writing the program and for systems operations must provide certain information to the operator who runs the program This information will vary with...

Страница 135: ...this varies for example remote job entry on the host and the communications utilities on the 5280 could be used or user written routines on the host and 5280 See Chapter 4 for the system requirements...

Страница 136: ...yte records With the DECK NODECK option described in Chapter 7 you can cause the compiler to create load modules with 80 byte records Use this option if you require 80 byte records for your host subsy...

Страница 137: ...Segmented When programs are segmented the data set name you specify at allocation is determined by the PROGRAM ID name of the segmented program Specify the data set name as follows 1 If the PROGRAM I...

Страница 138: ...ur program SYSLABEL will prompt you to enter one of the following exchange types basic H or I The data exchange you select determines the structure of your data set as discussed below Unblocked and un...

Страница 139: ...ted prompt appears This information applies only when 1 you allocate a data set for a file with an indexed organization and 2 you are going to create that file with the sequential access method In cre...

Страница 140: ...ent Improved Performance when Creating Indexed Files When creating files with an indexed organization a program will execute faster when using the sequential rather than the random access method Impro...

Страница 141: ...ion associated with the keyboard 5 Press the Enter key Prompts for Run Time Options User Parameter If the PROMPT option described in Chapter 7 is in effect the following prompts will appear Either pre...

Страница 142: ...u determine the use of the UPSI switch by the logic in your program See the 5280 COBOL Language Reference under the SPECIAL NAMES PARAGRAPH for information on how these switches are defined The SYSOUT...

Страница 143: ...ht enter one of the following dsname which is the name of the data set specified when it was allocated with the diskette label maintenance utility or volid dsname where volid is the name of the volume...

Страница 144: ...is the first eight characters of the file name you code in the SELECT statement in your COBOL program For device address the operator can enter either the 4 digit physical address 4000 4400 etc or the...

Страница 145: ...es available depends on the size of the screens available in your 5280 system Four status line formats are used depending upon the conditions being displayed Normal operations Keyboard error Device er...

Страница 146: ...last 16 positions of the data set name given at allocation COBOL execution errors usually occur because of faulty logic in the program Some possible causes of these errors are discussed in Chapter 9...

Страница 147: ...8 14 IBM 5280 COBOL Programmer s Guide...

Страница 148: ...essages in varying degrees of severity The compiler can issue five types of messages Information Messages Warning Messages Error Messages Severe Error Messages Unrecoverable Error Messages Information...

Страница 149: ...on can cause a compiler phase to stop processing or a further type of error to occur such as a program check Compiler logic errors are sometimes recognized by the compiler and an appropriate diagnosti...

Страница 150: ...found by the compiler but may cause problems at execution are listed below with a possible remedy INDEX or subscript is out of range Use the debugging line facility or the USE FOR DEBUGGING declarati...

Страница 151: ...your program to examine its internal status during execution With the USE FOR DEBUGGING dec1arative you identify program elements you wish to monitor COBOL then gives control to your debugging procedu...

Страница 152: ...OUTPUT SECTION FILE CONTROL SELECT SCREEN FILE PR3 ASSIGN TO WORKSTATION 1920 ORGANIZATION IS TRANSACTION ACCESS MODE IS SEQUENTIAL FILE STATUS IS TUBE STAT CONTROL AREA IS WSTATION CONTROL AREA SELEC...

Страница 153: ...MOVE 0 TO CONTINUE MOVE 1 TO ERROR FOUND INVALID EMPNO IF CONTINUE 1 IF ACREC NOT EQUAL TO F MOVE 1 TO ACTIVE RECORD ERROR FOUND MOVE 0 TO CONTINUE ELSE MOVE A TO ACREC UPDATE lo ASTER II D DISPLAY UP...

Страница 154: ...executed resides You can code either a two byte logical ID followed by two blanks or a four byte physical address in this field dataset name specifies the name of the data set that contains the next...

Страница 155: ...is allows the logic of your program to determine which program will be loaded and executed next after for example a STOP RUN statement in the current program is executed 4 In programs with more than o...

Страница 156: ...r direct support routines Before Running a Data Communication Program Functions Supported Before running a data communication program you must ensure that the proper communications environment exists...

Страница 157: ...of the statement to call the TINIT routine is CALL AVCLINIT USING parameter l buffer 2 parameter l and buffer 2 are data items you code as follows 01 parameter 1 02 return code PIC 9999 02 record len...

Страница 158: ...application program and the host communication program The format of the statement to call the TTERM routine is CALL AVCLTERM USING return code return code is a data item you code as follows 01 retur...

Страница 159: ...utine upon completion The return codes and their meanings are explained in the IBM 5280 Communications Reference Manual SC34 0247 record length the length of the data read as posted by CAM read type f...

Страница 160: ...tains a code posted by the TCTL routine upon completion The return codes and their meanings are explained in the IBM 5280 Communications Reference Manual SC34 0247 control the device control command F...

Страница 161: ...A 6 IBM 5280 COBOL Programmer s Guide...

Страница 162: ...tus Key Meaning 0 Successful Completion 0 No further information I At End no next logical 0 No further information record 2 Invalid Key 0 No further information I Sequence error 2 Duplicate key duplic...

Страница 163: ...s File is locked Second attempt to open a TRANSACTION I O file 93 Insufficient main storage for buffers See table 7 for additional causes 95 COBOL detected invalid file characteristics ASCII not confi...

Страница 164: ...le 92 Invalid request For example a WRITE or READ attempted on an unopened data set a WRITE attempted on a file opened for input only File is not open Second attempt to open a TRANSACTION I 0 file Tra...

Страница 165: ...rror detected 30 I O Error See Table 7 for additional causes 92 File already closed CLOSE UNIT issued to a multivolume data set CLOSE UNIT issued to last volume of multivolume data set 95 The sequence...

Страница 166: ...ilable for buffers See Table 7 for additional causes 95 COBOL detected invalid file characteristics ASCII not configured in system file is declared as ASCII COBOL record size not equal to record size...

Страница 167: ...pace for insert 92 Key changed between READ and a REWRITE or DELETE request SEQUENTIAL ACCESS only Invalid request such as READ when opened for OUTPUT REWRITE DELETE during sequential processing not p...

Страница 168: ...ctive sector 3209 Erase mismatch off 3212 Lost ready when busy 3251 CRC error 3301 Byte miscompare 3302 ID mismatch 3303 Head not positioned 3304 3305 Missing address marker 3306 Initialization of tra...

Страница 169: ...e label format 3226 Overlapped extents 3227 Two data sets with same name 3228 Invalid label standard version 3231 Invalid data set name 3232 Invalid delete character 3233 DSN must be simple name 3235...

Страница 170: ...Numeric numeric edited items PERFORM N TIMES Printer line length PROCEDURE DIVISION USING Structures Table size Tables length 5 32767 bytes length 5 127 bytes Max 10 COBOL programs number of data item...

Страница 171: ...c 2 IBM 5280 COBOL Programmer s Guide...

Страница 172: ...sible There are times when the compiler is not in control of the circumstances under which it terminates such as When the system detects an error condition When a compiler issued instruction receives...

Страница 173: ...gned or assigned IGNORE 2 Device not ready not operational or not DASD For OS this ABEND can also occur if the record length of the data set does not agree with the record length determined by the DEC...

Страница 174: ...additional work space needed for compilation Auxiliary Storage Requirements for Compiler and Library Residence The auxiliary storage required by the 5280 COBOL compiler and its permanent data set is a...

Страница 175: ...data sets until the procedure is finished Data Set Name Block Size Number of Blocks SYS 1 AVCSAMP 1600 20 SYS 1 AVCLDOUT 128 200 Execution Time Considerations The amount of 5280 storage must be suffi...

Страница 176: ...0 blocks Work Space and Load Module Output Requirements The COBOL compiler requires additional work space beyond the dynamic storage needed for execution The work space needed varies with the number o...

Страница 177: ...load module created is a complete 5280 partition and its size is printed by the compiler The input output device requirements for execution of the problem program are determined from specifications ma...

Страница 178: ...record description statement 2 12 clearing the screen with WRITE 3 4 CLOSE in transaction I O 3 4 Close routine 4 4 CMPAT option 7 10 codes compiler return C 2 coding aids for transaction I O v coding...

Страница 179: ...ord description statements 2 13 Duplicate key 1 10 X 2 IBM 5280 COBOL Programmer s Guide E Editing Field example 2 4 2 8 in field description statement 2 21 in record description statements 2 12 see a...

Страница 180: ...modules compilation requirements 7 1 INVALID KEY clause 5 8 J job to jobfacility 10 1 10 2 K keyboard 5280 1 5 L language option RUNMSG 7 15 length field 2 16 LINECOUNT option 7 12 linkage between CO...

Страница 181: ...5 16 X 4 IBM 5280 COBOL Programmer s Guide reading from a relative file 5 18 Status Key cvdc B updating a relative file 5 18 relative key 5 16 5 2 Reset key I I 2 return codes compiler D l data commu...

Страница 182: ...2 25 Status Key codes B 1 B 3 unshared files 5 5 updating indexed files 5 28 relative files 5 18 sequential files 5 12 UPSI switch 8 8 Usage field in field description statement 2 18 2 20 in record d...

Страница 183: ...X 6 IBM 5280 COBOL Programmer s Guide...

Страница 184: ...s and omissions give page numbers IBM may use and distribute any of the information you supply in any way it believes appropriate without incurring any obligation whatever You may of course continue t...

Страница 185: ...IT NO 40 ARMONK NEW YORK POSTAGE WILL BE PAID BY ADDRESSEE International Business Machines Corporation Information Systems Division Dept 26X 037 2800 Sand Hill Road Menlo Park CA 94025 Please do not s...

Страница 186: ......

Страница 187: ...tems Division 4111 Northside Parkway N W P O Box 2150 Atlanta Georgia 30301 U S A only General Business Group International 44 South Broadway White Plains New York 10601 I nternational SL23 0032 1 Pri...

Отзывы: