1 / 13

Screen Section

Screen Section. Please use speaker notes for additional information!. IDENTIFICATION DIVISION. PROGRAM-ID. SCR1FROM. AUTHOR. GROCER. ENVIRONMENT DIVISION. INPUT-OUTPUT SECTION. FILE-CONTROL. SELECT INPUT-FILE ASSIGN TO "A:SCR1.DAT".

ira
Download Presentation

Screen Section

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. Screen Section Please use speaker notes for additional information!

  2. IDENTIFICATION DIVISION. PROGRAM-ID. SCR1FROM. AUTHOR. GROCER. ENVIRONMENT DIVISION. INPUT-OUTPUT SECTION. FILE-CONTROL. SELECT INPUT-FILE ASSIGN TO "A:\SCR1.DAT". DATA DIVISION. FILE SECTION. FD INPUT-FILE DATA RECORD IS INPUT-REC. 01 INPUT-REC. 05 ID-INPIC XXXX. 05 NAME-IN PIC X(20). WORKING-STORAGE SECTION. 01 INDICATORS. 05 EOF-IND PIC XXX VALUE "NO ". 01 RESPONSES. 05 RESPONSE-IN-WSPIC X VALUE SPACES. SCREEN SECTION. 01 DATA-ENTRY-SCREEN BACKGROUND-COLOR IS 3 FOREGROUND-COLOR IS 5 BLANK SCREEN. 05 VALUE "DATA ENTRY SCREEN" LINE 01 COL 30. 05 VALUE "ID #: " LINE 05 COL 05. 05 ID-ON-SCR-IN LINE 05 COL 15 PIC XXXXFROMID-IN. 05 VALUE "NAME:" LINE 07 COL 05. 05 NAME-ON-SCR-IN LINE 07 COL 15 PIC X(20) FROM NAME-IN. 05 VALUE "C - TO CONTINUE" LINE 16 COL 30. 05 VALUE "Q - TO QUIT" LINE 17 COL 30. 05 VALUE "ENTER CHOICE:" LINE 19 COL 30. 05 RESPONSE-SCR LINE 19 COL 45 PIC XTO RESPONSE-IN-WS. SCR1AFRM.CBL The SCREEN SECTION allows the programmer to layout the entire look of the screen - usually the limit is 24 lines deep and a max of 80 characters across (usually 80 means scrolling.) Here I am setting the background and foreground colors for the screen and cleaning it out prior to displaying it. When you are just putting up a literal, you can use VALUE with the location. The name of the field where data will be displayed is not used in this program. The FROM clause tells where the data is coming from - in this case from the input record. Note that the PIC is the same size. Response is taken in TO and stored.

  3. PROCEDURE DIVISION. MAINLINE. PERFORM A-100-INITIALIZE. PERFORM B-100-PROCESS. PERFORM C-100-TERMINATE. STOP RUN. 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 RESPONSE-IN-WS = "Q". B-200-LOOP. DISPLAY DATA-ENTRY-SCREEN. ACCEPT DATA-ENTRY-SCREEN. READ INPUT-FILE AT END MOVE "YES" TO EOF-IND. C-100-TERMINATE. CLOSE INPUT-FILE. *Input file: *1111Linda L. Hall *1212Stephen Daniels *1234David T. Anderson *245Peter Lyons *1228Daniel Russel *2222Ann Costa *2525Russel Warren *2728Ann Daniels *3333William Souza *3456Larry Richards *4444Marilyn Smith *4567Dale Ponti *5517Mary Collins *6666Robert Fallon SCR1AFRM.CBL The DISPLAY puts the contents of DATA-ENTRY-SCREEN on the screen including the things referred to by the FROM clause. The ACCEPT takes in anything the user enters using the TO clause.

  4. IDENTIFICATION DIVISION. PROGRAM-ID. SCR1FROM. AUTHOR. GROCER. ENVIRONMENT DIVISION. INPUT-OUTPUT SECTION. FILE-CONTROL. SELECT INPUT-FILE ASSIGN TO "A:\SCR1.DAT". DATA DIVISION. FILE SECTION. FD INPUT-FILE DATA RECORD IS INPUT-REC. 01 INPUT-REC PIC X(24). WORKING-STORAGE SECTION. 01 INDICATORS. 05 EOF-IND PIC XXX VALUE "NO ". 01 RESPONSES. 05 RESPONSE-IN-WS PIC X VALUE SPACES. 01 DATA-FOR-SCREEN. 05 ID-IN-WS PIC XXXX VALUE SPACES. 05 NAME-IN-WS PIC X(20) VALUE SPACES. SCREEN SECTION. 01 DATA-SCREEN BACKGROUND-COLOR IS 3 BLANK SCREEN. 05 VALUE "DATA SCREEN" LINE 01 COL 30. 05 VALUE "ID #: " LINE 05 COL 05. 05 ID-ON-SCR-IN LINE 05 COL 15 PIC XXXX FROM ID-IN-WS. 05 VALUE "NAME:" LINE 07 COL 05. 05 NAME-ON-SCR-IN LINE 07 COL 15 PIC X(20) FROM NAME-IN-WS. 05 VALUE "C - TO CONTINUE" LINE 16 COL 30. 05 VALUE "Q - TO QUIT" LINE 17 COL 30. 05 VALUE "ENTER CHOICE:" LINE 19 COL 30. 05 RESPONSE-SCR LINE 19 COL 45 PIC X TO RESPONSE-IN-WS. SCR1FROM.CBL

  5. SCR1FROM.CBL PROCEDURE DIVISION. MAINLINE. PERFORM A-100-INITIALIZE. PERFORM B-100-PROCESS. PERFORM C-100-TERMINATE. STOP RUN. A-100-INITIALIZE. OPEN INPUT INPUT-FILE. B-100-PROCESS. READ INPUT-FILE INTO DATA-FOR-SCREEN AT END MOVE "YES" TO EOF-IND. PERFORM B-200-LOOP UNTIL EOF-IND = "YES" OR RESPONSE-IN-WS = "Q". B-200-LOOP. DISPLAY DATA-SCREEN. ACCEPT DATA-SCREEN. READ INPUT-FILE INTO DATA-FOR-SCREEN AT END MOVE "YES" TO EOF-IND. C-100-TERMINATE. CLOSE INPUT-FILE. The READ…INTO takes the record that was read and puts a copy into DATA-FOR-SCREEN. The DISPLAY puts the data on the screen and the ACCEPT takes user input. FD INPUT-FILE DATA RECORD IS INPUT-REC. 01 INPUT-REC PIC X(24). WORKING-STORAGE SECTION. 01 INDICATORS. 05 EOF-IND PIC XXX VALUE "NO ". 01 RESPONSES. 05 RESPONSE-IN-WS PIC X VALUE SPACES. 01 DATA-FOR-SCREEN. 05 ID-IN-WS PIC XXXX VALUE SPACES. 05 NAME-IN-WS PIC X(20) VALUE SPACES.

  6. SCR1FROM.CBL

  7. SCR1TO.CBL IDENTIFICATION DIVISION. PROGRAM-ID. SCR1TO. ENVIRONMENT DIVISION. INPUT-OUTPUT SECTION. FILE-CONTROL. SELECT OUTPUT-FILE ASSIGN TO "A:\SCR1TO.DAT". DATA DIVISION. FILE SECTION. FD OUTPUT-FILE DATA RECORD IS OUTPUT-REC. 01 OUTPUT-REC PIC X(24). WORKING-STORAGE SECTION. 01 RESPONSES. 05 RESPONSE-IN-WS PIC X VALUE SPACES. 01 DATA-FROM-SCREEN. 05 ID-IN-WS PIC XXXX VALUE SPACES. 05 NAME-IN-WS PIC X(20) VALUE SPACES. SCREEN SECTION. 01 DATA-ENTRY-SCREEN BACKGROUND-COLOR IS 7 FOREGROUND-COLOR IS 4 BLANK SCREEN. 05 VALUE "DATA ENTRY SCREEN" LINE 01 COL 30. 05 VALUE "ID #: " LINE 05 COL 05. 05 ID-ON-SCR-IN LINE 05 COL 15 PIC XXXX TO ID-IN-WS. 05 VALUE "NAME:" LINE 07 COL 05. 05 NAME-ON-SCR-IN LINE 07 COL 15 PIC X(20) TO NAME-IN-WS. 05 VALUE "C - TO CONTINUE" LINE 16 COL 30. 05 VALUE "Q - TO QUIT" LINE 17 COL 30. 05 VALUE "ENTER CHOICE:" LINE 19 COL 30. 05 RESPONSE-SCR LINE 19 COL 45 PIC X TO RESPONSE-IN-WS.

  8. SCR1TO.CBL PROCEDURE DIVISION. MAINLINE. PERFORM A-100-INITIALIZE. PERFORM B-100-PROCESS. PERFORM C-100-TERMINATE. STOP RUN. A-100-INITIALIZE. OPEN OUTPUT OUTPUT-FILE. B-100-PROCESS. MOVE SPACES TO OUTPUT-REC. DISPLAY DATA-ENTRY-SCREEN. ACCEPT DATA-ENTRY-SCREEN. PERFORM B-200-LOOP UNTIL RESPONSE-IN-WS = "Q". B-200-LOOP. IF RESPONSE-IN-WS = "C" WRITE OUTPUT-REC FROM DATA-FROM-SCREEN. MOVE SPACES TO OUTPUT-REC. DISPLAY DATA-ENTRY-SCREEN. ACCEPT DATA-ENTRY-SCREEN. C-100-TERMINATE. CLOSE OUTPUT-FILE. The information stored in DATA-FROM-SCREEN is moved to OUTPUT-REC and written if the user responses to the screen with a C. The initializing display and accept takes in the information for the first record. From this point forward, the display and accept will be at the bottom of the loop.

  9. SCR1TO.CBL

  10. IDENTIFICATION DIVISION. PROGRAM-ID. SCR2TO. ENVIRONMENT DIVISION. INPUT-OUTPUT SECTION. FILE-CONTROL. SELECT OUTPUT-FILE ASSIGN TO "A:\SCR2.DAT". DATA DIVISION. FILE SECTION. FD OUTPUT-FILE DATA RECORD IS OUTPUT-REC. 01 OUTPUT-REC PIC X(24). WORKING-STORAGE SECTION. 01 RESPONSES. 05 RESPONSE-IN-WS PIC X VALUE SPACES. 01 DATA-FROM-SCREEN. 05 ID-IN-WS PIC XXXX VALUE SPACES. 05 NAME-IN-WS PIC X(20) VALUE SPACES. SCREEN SECTION. 01 DATA-ENTRY-SCREEN. 05 ID-SECTION. 10 VALUE "DATA ENTRY SCREEN" BLANK SCREEN LINE 01 COL 30. 10 VALUE "ID #: " LINE 05 COL 05. 10 ID-ON-SCR-IN LINE 05 COL 15 PIC XXXX TO ID-IN-WS. 05 NAME-SECTION. 10 VALUE "NAME:" LINE 07 COL 05. 10 NAME-ON-SCR-IN LINE 07 COL 15 PIC X(20) TO NAME-IN-WS. 05 RESPONSE-SECTION. 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 RESPONSE-IN-WS. SCR2TO.CBL

  11. SCR2TO.CBL PROCEDURE DIVISION. MAINLINE. PERFORM A-100-INITIALIZE. PERFORM B-100-PROCESS. PERFORM C-100-TERMINATE. STOP RUN. A-100-INITIALIZE. OPEN OUTPUT OUTPUT-FILE. B-100-PROCESS. MOVE SPACES TO OUTPUT-REC. DISPLAY ID-SECTION. ACCEPT ID-ON-SCR-IN DISPLAY NAME-SECTION. ACCEPT NAME-ON-SCR-IN. DISPLAY RESPONSE-SECTION. ACCEPT RESPONSE-SCR. PERFORM B-200-LOOP UNTIL RESPONSE-IN-WS = "Q". B-200-LOOP. IF RESPONSE-IN-WS = "C" WRITE OUTPUT-REC FROM DATA-FROM-SCREEN. MOVE SPACES TO OUTPUT-REC. DISPLAY ID-SECTION. ACCEPT ID-ON-SCR-IN. DISPLAY NAME-SECTION. ACCEPT NAME-ON-SCR-IN. DISPLAY RESPONSE-SECTION. ACCEPT RESPONSE-SCR. C-100-TERMINATE. CLOSE OUTPUT-FILE. This shows the use of the three sections. Each is displayed and accepted separately.

  12. IDENTIFICATION DIVISION. PROGRAM-ID. SCR1USE. ENVIRONMENT DIVISION. INPUT-OUTPUT SECTION. FILE-CONTROL. SELECT DATA-FILE ASSIGN TO "A:\SCR2.DAT". DATA DIVISION. FILE SECTION. FD DATA-FILE DATA RECORD IS DATA-REC. 01 DATA-REC PIC X(24). WORKING-STORAGE SECTION. 01 INDICATORS. 05 EOF-IND PIC XXX VALUE "NO ". 01 RESPONSES. 05 RESPONSE-IN-WS PIC X VALUE SPACES. 01 DATA-ON-SCREEN. 05 ID-IN-WS PIC XXXX VALUE SPACES. 05 NAME-IN-WS PIC X(20) VALUE SPACES. SCREEN SECTION. 01 DATA-ENTRY-SCREEN. 05 VALUE "DATA ENTRY SCREEN" BLANK SCREEN LINE 01 COL 30. 05 VALUE "ID #: " LINE 05 COL 05. 05 ID-ON-SCR-IN LINE 05 COL 15 PIC XXXX FROM ID-IN-WS. 05 VALUE "NAME:" LINE 07 COL 05. 05 NAME-ON-SCR-IN LINE 07 COL 15 PIC X(20) USING NAME-IN-WS. 05 VALUE "C - TO CONTINUE" LINE 15 COL 30. 05 VALUE "R - REWRITE RECORD" LINE 16 COL 30. 05 VALUE "Q - TO QUIT" LINE 17 COL 30. 05 VALUE "ENTER CHOICE:" LINE 19 COL 30. 05 RESPONSE-SCR LINE 19 COL 45 PIC X TO RESPONSE-IN-WS. SCR1USE.CBL The USING displays data and then lets the user change it.

  13. SCR1USE.CBL PROCEDURE DIVISION. MAINLINE. PERFORM A-100-INITIALIZE. PERFORM B-100-PROCESS. PERFORM C-100-TERMINATE. STOP RUN. A-100-INITIALIZE. OPEN I-O DATA-FILE. B-100-PROCESS. READ DATA-FILE INTO DATA-ON-SCREEN AT END MOVE "YES" TO EOF-IND. PERFORM B-200-LOOP UNTIL EOF-IND = "YES" OR RESPONSE-IN-WS = "Q". B-200-LOOP. DISPLAY DATA-ENTRY-SCREEN. ACCEPT DATA-ENTRY-SCREEN. IF RESPONSE-IN-WS = "R" REWRITE DATA-REC FROM DATA-ON-SCREEN. READ DATA-FILE INTO DATA-ON-SCREEN AT END MOVE "YES" TO EOF-IND. C-100-TERMINATE. CLOSE DATA-FILE.

More Related