1 / 8

COBOL Screens

COBOL Screens. Please use speaker notes for additional information!. Scrntest.cbl. IDENTIFICATION DIVISION. PROGRAM-ID. SCROCCUR. AUTHOR. GROCER. ENVIRONMENT DIVISION. INPUT-OUTPUT SECTION. FILE-CONTROL. SELECT INPUT-FILE

Anita
Télécharger la présentation

COBOL Screens

An Image/Link below is provided (as is) to download presentation Download Policy: Content on the Website is provided to you AS IS for your information and personal use and may not be sold / licensed / shared on other websites without getting consent from its author. Content is provided to you AS IS for your information and personal use only. Download presentation by click this link. While downloading, if for some reason you are not able to download a presentation, the publisher may have deleted the file from their server. During download, if you can't get a presentation, the file might be deleted by the publisher.

E N D

Presentation Transcript


  1. COBOL Screens Please use speaker notes for additional information!

  2. Scrntest.cbl IDENTIFICATION DIVISION. PROGRAM-ID. SCROCCUR. AUTHOR. GROCER. ENVIRONMENT DIVISION. INPUT-OUTPUT SECTION. FILE-CONTROL. SELECT INPUT-FILE ASSIGN TO "C:\PCOBWIN\CIS12FST\SCR1.DAT". DATA DIVISION. FILE SECTION. FD INPUT-FILE DATA RECORD IS INPUT-REC. 01 INPUT-REC. 05 ID-IN PIC XXXX. 05 NAME-IN PIC X(20). WORKING-STORAGE SECTION. 01 INDICATORS. 05 EOF-IND PIC XXX VALUE "NO ". 01 RESPONSES. 05 SCR-RESP-WS PIC X VALUE SPACES. 05 CUR PIC 99 VALUE 4. 05 CT PIC 9 VALUE 0. Information from the screen is stored here. Responses used in processing.

  3. Scrntest.cbl Header information displayed at the top of the screen. SCREEN SECTION. 01 DATA-SCREEN. 05 HDR-INFO. 10 VALUE "DATA SCREEN" BLANK SCREEN LINE 01 COL 30. 10 VALUE "ID #" LINE 03 COL 12. 10 VALUE "NAME" LINE 03 COL 17. 05 INFO-SCR-IN. 10 ID-ON-SCR-IN LINE CUR COL 12 PIC XXXX FROM ID-IN. 10 NAME-ON-SCR-IN LINE CUR COL 17 PIC X(20) FROM NAME-IN. 05 RESP-INFO. 10 VALUE "C - TO CONTINUE" LINE 16 COL 30. 10 VALUE "Q - TO QUIT" LINE 17 COL 30. 10 VALUE "ENTER CHOICE:" LINE 19 COL 30. 10 RESPONSE-SCR LINE 19 COL 45 PIC X TO SCR-RESP-WS. PROCEDURE DIVISION. MAINLINE. PERFORM A-100-INITIALIZE. PERFORM B-100-PROCESS. PERFORM C-100-TERMINATE. STOP RUN. Detail information displayed on the current line. Note that CUR is set to 4 and will be incremented so the first line is displayed on line 5. This structure allows the programmer to display multiple copies of INFO-SCR-IN. The user will enter either C to continue or Q to quit when the RESP-INFO portion of the screen is displayed.

  4. Screen showing output HDR-INFO INFO-SCR-IN RESP-INFO

  5. Scrntest.cbl Performs the routine which will put up the repeating lines of information until either CT which counts the record is greater than 4, or EOF is reached or the user quits. A-100-INITIALIZE. OPEN INPUT INPUT-FILE. B-100-PROCESS. READ INPUT-FILE AT END MOVE "YES" TO EOF-IND. PERFORM B-200-LOOP UNTIL EOF-IND = "YES" OR SCR-RESP-WS = "Q". B-200-LOOP. MOVE 4 TO CUR. MOVE 0 TO CT. DISPLAY HDR-INFO. PERFORM B-300-SETUP UNTIL CT > 4 OR EOF-IND = "YES" OR SCR-RESP-WS = "Q". DISPLAY RESP-INFO. ACCEPT RESP-INFO. B-300-SETUP. ADD 1 TO CUR. ADD 1 TO CT. DISPLAY INFO-SCR-IN. READ INPUT-FILE AT END MOVE "YES" TO EOF-IND. C-100-TERMINATE. CLOSE INPUT-FILE. Displays the header information on the screen. When the B-300-SETUP loop is finished, the response screen is displayed and the user response is accepted. This ends the pass through the B-200-LOOP, In this B-300-SETUP loop,1 is added to the current line, CUR and to the CT which is counting the records. Then the information is displayed and another record is read.

  6. IDENTIFICATION DIVISION. PROGRAM-ID. SCROCCUR. AUTHOR. GROCER. ENVIRONMENT DIVISION. INPUT-OUTPUT SECTION. FILE-CONTROL. SELECT INPUT-FILE ASSIGN TO "C:\PCOBWIN\CIS12FST\SCR1.DAT". DATA DIVISION. FILE SECTION. FD INPUT-FILE DATA RECORD IS INPUT-REC. 01 INPUT-REC. 05 ID-IN PIC XXXX. 05 NAME-IN PIC X(20). WORKING-STORAGE SECTION. 01 INDICATORS. 05 EOF-IND PIC XXX VALUE "NO ". 01 RESPONSES. 05 SCR-RESP-WS PIC X VALUE SPACES. 05 CUR PIC 99 VALUE 4. 05 SUBZ PIC 9 VALUE 0. 01 DATA-FOR-SCREEN. 05 INFO-FOR-SCR OCCURS 5 TIMES. 10 ID-IN-WS PIC XXXX. 10 NAME-IN-WS PIC X(20). Scroccur.cbl

  7. 01 DATA-FOR-SCREEN. 05 INFO-FOR-SCR OCCURS 5 TIMES. 10 ID-IN-WS PIC XXXX. 10 NAME-IN-WS PIC X(20). Scroccur.cbl SCREEN SECTION. 01 DATA-SCREEN. 05 HDR-INFO. 10 VALUE "DATA SCREEN" BLANK SCREEN LINE 01 COL 30. 10 VALUE "ID #" LINE 03 COL 12. 10 VALUE "NAME" LINE 03 COL 17. 05 INFO-SCR-IN. 10 ID-ON-SCR-IN LINE CUR COL 12 PIC XXXX FROM ID-IN-WS (SUBZ). 10 NAME-ON-SCR-IN LINE CUR COL 17 PIC X(20) FROM NAME-IN-WS (SUBZ). 05 RESP-INFO. 10 VALUE "C - TO CONTINUE" LINE 16 COL 30. 10 VALUE "Q - TO QUIT" LINE 17 COL 30. 10 VALUE "ENTER CHOICE:" LINE 19 COL 30. 10 RESPONSE-SCR LINE 19 COL 45 PIC X TO SCR-RESP-WS. PROCEDURE DIVISION. MAINLINE. PERFORM A-100-INITIALIZE. PERFORM B-100-PROCESS. PERFORM C-100-TERMINATE. STOP RUN.

  8. A-100-INITIALIZE. OPEN INPUT INPUT-FILE. B-100-PROCESS. READ INPUT-FILE AT END MOVE "YES" TO EOF-IND. PERFORM B-200-LOOP UNTIL EOF-IND = "YES" OR SCR-RESP-WS = "Q". B-200-LOOP. MOVE 4 TO CUR. MOVE 0 TO SUBZ. DISPLAY HDR-INFO. PERFORM B-300-SETUP UNTIL SUBZ > 4 OR EOF-IND = "YES" OR SCR-RESP-WS = "Q". DISPLAY RESP-INFO. ACCEPT RESP-INFO. B-300-SETUP. ADD 1 TO SUBZ. ADD 1 TO CUR. MOVE ID-IN TO ID-IN-WS(SUBZ). MOVE NAME-IN TO NAME-IN-WS (SUBZ). DISPLAY INFO-SCR-IN. READ INPUT-FILE AT END MOVE "YES" TO EOF-IND. C-100-TERMINATE. CLOSE INPUT-FILE. Scroccur.cbl The record that was read is in ID-IN and NAME-IN> These two fields are now moved to the table in WORKING-STORAGE that provides the information to the screen. A information is moved to the table, it is displayed on the screen.

More Related