Prev: Visual Cobol
Next: data conversion
From: john on 6 Aug 2005 18:03 All my COBOL manuals and books wre written before screen handling became standardized. I can find good examples of displaying pretty thing on the screen but none showing how you ACCEPT data in a SCREEN environment. In addition to the mechanics of same there are some gotchas when the whole screen is accepted at once, or so I read on the newsgroup. Can someone point me to a fairly simple worked example of a data screen DISPLAYed and then the data thereon ACCEPTed? I have a newer book on order but it isn't here yet. I am using TinyCobol on a Slackware system. John Culleton, AKA Rip Van Winkle.
From: Richard on 6 Aug 2005 19:42 > Can someone point me to a fairly simple worked example > of a data screen DISPLAYed and then the data thereon > ACCEPTed? When doing Accept/display I generally accept each field in turn allowing back field.
From: Kellie Fitton on 7 Aug 2005 02:30 Hi, Here is a sample code for Accept/Dispaly statement for microFocus Cobol: IDENTIFICATION DIVISION. PROGRAM-ID. SAMPLE. ENVIRONMENT DIVISION. CONFIGURATION SECTION. SOURCE-COMPUTER. IBM-ATX. OBJECT-COMPUTER. IBM-ATX. SPECIAL-NAMES. INPUT-OUTPUT SECTION. FILE-CONTROL. DATA DIVISION. FILE SECTION. WORKING-STORAGE SECTION. 01 300-ACTIVE-SPACES VALUE SPACES. 05 300-COMPANY-NAME PIC X(30). 05 300-LAST-NAME PIC X(25). 05 300-FIRST-NAME PIC X(15). 05 300-MAIL-ADDRESS PIC X(30). SCREEN SECTION. 01 CLEAR-SCREEN. 05 BLANK SCREEN BACKGROUND-COLOR 5 FOREGROUND-COLOR 7. 01 INPUT-SCREEN AUTO. 05 BACKGROUND-COLOR 5 FOREGROUND-COLOR 7. 05 LINE 6 COLUMN 22 HIGHLIGHT 'COMPANY: '. 05 COMPANY-NAME REVERSE-VIDEO PIC X(30) USING 300-COMPANY-NAME. 05 LINE 7 COLUMN 20 HIGHLIGHT 'LAST NAME: '. 05 LAST-NAME REVERSE-VIDEO PIC X(25) USING 300-LAST-NAME. 05 LINE 8 COLUMN 19 HIGHLIGHT 'FIRST NAME: '. 05 FIRST-NAME REVERSE-VIDEO PIC X(15) USING 300-FIRST-NAME. 05 LINE 9 COLUMN 22 HIGHLIGHT 'ADDRESS: '. 05 MAIL-ADDRESS REVERSE-VIDEO PIC X(30) USING 300-MAIL-ADDRESS. PROCEDURE DIVISION. 100-MAIN-MODULE. DISPLAY CLEAR-SCREEN. DISPLAY INPUT-SCREEN. ACCEPT INPUT-SCREEN. STOP RUN. You could also code the Accept/Display statement like this: display "Enter your last name: " at 1010. accept lastName at 1033. display "Enter your first name: " at 1110. accept firstName at 1133. display "Enter your address: " at 1210. accept mailing-address at 1233. stop run. Hope these information helps, Kellie.
From: john on 7 Aug 2005 13:31 Excellent. I presume you ACCEPT the field as it is described in the SCREEN but validate the corresponding field in WORKING-STORAGE. Did I guess right? John C.
From: john on 7 Aug 2005 13:32
Excellent. I presume you ACCEPT the field as it is described in the SCREEN but validate the corresponding field in WORKING-STORAGE. Did I guess right? John C. |