IDENTIFICATION DIVISION.
PROGRAM-ID. TEST-3270.
*>
*>  CobCurses Example 3270 Mode Program :
*>  Warren W. Gay
*>
*>  $Id: 3270test.cob,v 1.4 2007/10/30 13:05:20 ve3wwg Exp $
*>
*>  ESSENTIALLY THIS PROGRAM DOES THE FOLLOWING:
*>
*>      1. OPEN COBCURSES (NC-OPEN)
*>      2. INITIALIZE SCREEN DEFNS
*>      3. INVOKE THE 3270 MODE FSM
*>      4. CLOSE COBCURSES (NC-CLOSE)
*>      5. DISPLAY THE VALUES RETURNED FROM THE SCREEN FORM
*>
*>  NOTE:
*>      NORMALLY A MAIN PROGRAM WOULD OPEN COBCURSES (NC-OPEN) AND THEN
*>      CALL THE SCREEN. HERE WE HAVE CHEATED FOR BREVITY'S SAKE.
*>
DATA DIVISION.
WORKING-STORAGE SECTION.

    COPY COBCATTR.                                      *> DEFINE TERMINAL ATTRIBUTES
    COPY COBCCOLOUR.                                    *> DEFINE TERMINAL COLOURS
    COPY COBCURSG.                                      *> COBCURSES GLOBAL DEFNS
    COPY COBCURSL.                                      *> COBCURSES LOCAL DEFNS FOR SCREEN

    COPY 3270TEST-WS.                                   *> GENERATED SCREEN WS DATA ITEMS

PROCEDURE DIVISION.

MAIN-PROGRAM.
    PERFORM 1000-INITIALIZE.
    PERFORM 5000-PROCESS.
    PERFORM 9000-FINALIZE.

    DISPLAY "    FLD-ITEM-NUMBER='", FLD-ITEM-NUMBER, "'".
    DISPLAY "  FLD-CUSTOMER-NAME='", FLD-CUSTOMER-NAME, "'".
    DISPLAY "      FLD-ADDRESS-1='", FLD-ADDRESS-1, "'".
    DISPLAY "      FLD-ADDRESS-2='", FLD-ADDRESS-2, "'".
    DISPLAY "           FLD-CITY='", FLD-CITY, "'".
    DISPLAY " FLD-STATE-PROVINCE='", FLD-STATE-PROVINCE, "'".
    DISPLAY "        FLD-COUNTRY='", FLD-COUNTRY, "'".
    DISPLAY "  FLD-HOME-PHONE-NO='", FLD-HOME-PHONE-NO, "'".
    DISPLAY "  FLD-CELL-PHONE-NO='", FLD-CELL-PHONE-NO, "'".
    DISPLAY "     FLD-FAX-NUMBER='", FLD-FAX-NUMBER, "'".
    DISPLAY "  FLD-EMAIL-ADDRESS='", FLD-EMAIL-ADDRESS, "'".
    DISPLAY "      FLD-VISA-FLAG='", FLD-VISA-FLAG, "'".
    DISPLAY "FLD-MASTERCARD-FLAG='", FLD-MASTERCARD-FLAG, "'".
    DISPLAY "    FLD-CARD-ZONE-1='", FLD-CARD-ZONE-1, "'".
    DISPLAY "    FLD-CARD-ZONE-2='", FLD-CARD-ZONE-2, "'".
    DISPLAY "    FLD-CARD-ZONE-3='", FLD-CARD-ZONE-3, "'".
    DISPLAY "    FLD-CARD-ZONE-4='", FLD-CARD-ZONE-4, "'".
    DISPLAY "  FLD-SECURITY-CODE='", FLD-SECURITY-CODE, "'".
    DISPLAY "-----------------------------------------".
    DISPLAY "     NC-FIELD-EXIT = '", NC-FIELD-EXIT, "'".
    DISPLAY "     NC-FIELD-FKEY = ", NC-FIELD-FKEY-NO.
    STOP RUN.

*>
*>  INITIALIZE THE SCREEN
*>
1000-INITIALIZE.
    PERFORM NC-OPEN.                                    *> OPEN TERMINAL (NORMALLY DONE BY A MAIN PROGRAM)
    PERFORM NC-INIT-3270.                               *> INITIALIZE COBCURSES FOR 3270 MODE SCREEN
    MOVE 'Y' TO NC-FKEY-EXEMPT(03).                     *> ALLOW F3 FKEY EXEMPTION (FROM VALIDATION)
    MOVE 'Y' TO NC-FKEY-EXEMPT(12).                     *> ALLOW F12 FKEY EXEMPTION
    COPY 3270TEST-PD.                                   *> INITIALIZE THIS SCREEN'S WS DATA ITEMS
    PERFORM NC-DRAW-SCREEN.                             *> PAINT THE BACKGROUND ON THIS SCREEN
    PERFORM NC-CLEAR-FIELDS.                            *> CLEAR ALL SCREEN FIELDS TO BLANKS
    PERFORM NC-DRAW-FIELDS.                             *> DRAW ALL FIELDS ON THE SCREEN
    EXIT.

*>
*>  THE SCREEN PROCESSING
*>
5000-PROCESS.
    PERFORM NC-3270-STATE-MACHINE.                      *> ALLOW THE USER TO EDIT THE 3270 FORM
    EXIT.

*>
*>  FINALIZE SCREEN PROCESSING
*>
9000-FINALIZE.
    PERFORM NC-FINALIZE.                                *> CURRENT SCREEN CLEANUP
    PERFORM NC-CLOSE.                                   *> CLOSE TERMINAL (NORMALLY A MAIN PGM OPERATION)
    EXIT.

    COPY COBCURSP.                                      *> FOR NC-OPEN/NC-CLOSE
    COPY COBCURSQ.                                      *> ALL OTHER NC-* SCREEN SUPPORT PARAGRAPHS
    COPY COBC3270.                                      *> 3270 MODE ONLY SUPPORT PARAGRAPHS

END PROGRAM TEST-3270.

*> $Source: /cvsroot/cobcurses/cobcurses/src/test/3270test.cob,v $
