Presentation is loading. Please wait.

Presentation is loading. Please wait.

Advanced RPG Chapter 8 Interactive Applicatons. Interactive Applications  Batch Processing: Program is run without human intervention or control.  Interactive.

Similar presentations


Presentation on theme: "Advanced RPG Chapter 8 Interactive Applicatons. Interactive Applications  Batch Processing: Program is run without human intervention or control.  Interactive."— Presentation transcript:

1 Advanced RPG Chapter 8 Interactive Applicatons

2 Interactive Applications  Batch Processing: Program is run without human intervention or control.  Interactive Processing: User driven  Display files are needed for interaction.  Screen Design Aid (SDA): Graphical utility that will generate DDS source code.

3 Screen Design Aid  You can have multiple record formats per DDS member.

4 Screen Design Aid Section Inquiry Type value, then Enter. Section number.. ____________ F3=Exit

5 Screen Design Aid Section Information Section number Course BIS350 Instructor Johnson Room Meets on days......MWF Starting Time :30 Enrollment Press Enter to Continue F3=Exit F12=Cancel

6 Screen Design Aid AAN01N02N03T.Name++++++RLen++TDpBLinPosFunctions ********** Beginning of data ************************************ A REF(SECTIONS) A INDARA A R SECT1 A CA03(03 'F3=EXIT') A 1 28'SECTION INQUIRY' A 3 2'TYPE VALUE, THEN ENTER.' A 5 5'SECTION NUMBER..' A SECTION 5A I 5 24 A 23 2'F3=EXIT'

7 Screen Design Aid AAN01N02N03T.Name++++++RLen++TDpBLinPosFunctions A R SECT2 A CA03(03 'F3=EXIT') A CA03(12 'F12=CANCEL') A 1 10'SECTION INFORMATION' A 3 2'SECTION NUMBER...' A SECTNO R O 3 29 A 3 2'COURSE ' A COURSE R O 4 29 A 5 2'INSTR ' A INSTR R O 5 29 A 6 2'ROOM ' A ROOM R O 6 29 A 7 2'MEETS ON DAYS...' A DAYS R O 7 29 A 8 2'STARTING TIME...' A BEGTIME R O 8 29 A 9 2'ENROLLMENT.....‘ A ENROLL R O 9 29 A 21 2'PRESS ENTER TO CONTINUE' A 23 2'F3=EXIT' A 23 11'F12=CANCEL'

8 Screen Design Aid  CA03(03 ‘F3=EXIT’)  CA: Command Attention, enables the function key of F3. Returns control to RPG program without passing user input values.  When F3 is pressed by the user, indicator 03 is turned on.  ‘F3=EXIT’: Programmer comment.

9 Screen Design Aid  CF03(03 ‘F3=EXIT’)  CF: Command Function  Functions the same as CA03 except that the values the user has inputted are passed back to the RPG program.  CA12(12 ‘F12=Cancel’)  Generally used to move the user back a screen.

10 Screen Design Aid  Display files are defined in File Specs just like any other file.  Full Procedural  Externally defined  Key is not relevant (position 34 blank)  type (position 17) is C for combined file, supports both input and output but as independent operations.  Optional keyword INDDS: Stores indicators passed to and from display file in data structure named Fkeys.

11 Screen Design Aid  Interactive programs are prone to “spaghetti code”.  flow of control is not straight forward  User can press F3 to Exit or F12 to Cancel  Causes programmer to back up, repeat or exit early.

12 Screen Design Aid WHILE user wants to continue (no Exit) Display first screen Obtain user’s response to the screen IF user wants to continue (no exit) Random read section file to get section information IF record found Display second screen Obtain user’s response ENDIF ENDWHILE

13 Screen Design Aid WHILE user wants to continue (no Exit) (*IN03 = *OFF) Display first screen (EXFMT Sect1) Obtain user’s response to the screen IF user wants to continue (no exit) (IF *IN03 = *OFF) Random read section file to get section information (Section CHAIN Sections) IF record found (IF %FOUND(Sections) Display second screen (EXFMT Sect2) Obtain user’s response ENDIF ENDWHILE

14 Screen Design Aid  Allowable functions for I/O  WRITE: Displays a screen and returns control to program without waiting for user input.  READ: Sends control to currently displayed screen waits for end of user input (usually triggered by Enter key)  EXFMT: Combines WRITE/READ, first writes a record to the screen and then waits for user input to the screen, when signaled it returns control to RPG program. USED MOST OFTEN!

15 Screen Design Aid  RPG IV gets away from referencing indicators  Must specify INDDS keyword in F Spec.  Indicator Data Structure in DDS (INDARA)  Define data structure in D Spec to contain indicators.  Only have to define the ones you are using. D FKeysDS99 D Exit 3 3N D Cancel 12 12N

16 Screen Design Aid CL0N01Factor Opcode&ExtExtended-factor2+++ C DOW NOT Exit C EXFMT Sect1 C IF NOT Exit C Section CHAIN Sections C IF %FOUND(Sections) C EXFMT Sect2 C ENDIF C ENDDO C EVAL *INLR = *ON C RETURN

17 DDS Keywords  File Level:  Must be on first line of DDS, before Record Format  REF: reference another file for specifications  INDARA: organize indicators into 99-byte data structure  MSGLOC: specifies message line for error messages (default is last line, 24)  File or Record Level:  CA or CF: coded at file level they will apply to all record formats within the file  PRINT: enables Print Key for user screen printing.  VLDCMDKEY: turns on indicator when users presses any valid command key

18 DDS Keywords  Record Level:  Appear on line record is named or lines immediately following, prior to field names.  BLINK: causes cursor to blink  OVERLAY: Display record without clearing previous record display.

19 DDS Keywords  Field Level:  Apply only to specific field it is associated.  EDTCDE, EDTWRD: format numeric output  DSPATR: Display Attribute, determines appearance. (BL – blinking field, UL – underline)  DSPATR(BL UL)

20 DDS Keywords  Field Level: Data Validation  VALUES: Specify exact values allowed.  VALUES(value1 value2...)  RANGE: Specify range of values allowed.  RANGE(low-value high-value)  COMP: Relational comparison with inputted value (EQ,NE,GT,NG,LT,NL,GE,LE):  COMP(GT 100)  CHECK: Validity checking (ME, MF, AB)  CHECK(Validity code)  ERRMSG:  TIME and DATE

21 DDS Keywords  Conditioning Indicators:  Field Keyword will only apply if conditioning indicator is turned on by the RPG program.

22 AAN01N02N03T.Name++++++RLen++TDpBLinPosFunctions ********** Beginning of data ************************************* A REF(SECTIONS) A PRINT A INDARA A R SECT1 A BLINK A CA03(03 'F3=EXIT') A 1 28'SECTION INQUIRY' A 3 2'TYPE VALUE, THEN ENTER.' A 5 5'SECTION NUMBER..' A SECTION 5A I 5 24 A DSPATR(UL) A DSPATR(HI) A ERRMSG('SECTION NOT FOUND‘ 90) A 23 2'F3=EXIT' A A R SECT2 A CA03(03 'F3=EXIT') A CA03(12 'F12=CANCEL') A 1 10'SECTION INFORMATION' A 3 2'SECTION NUMBER...' A SECTNO R O 3 29 A 3 2'COURSE ' A COURSE R O 4 29 A 5 2'INSTR ' A INSTR R O 5 29 A 6 2'ROOM ' A ROOM R O 6 29EDTCDE(Z) A 7 2'MEETS ON DAYS...' A DAYS R O 7 29 A 8 2'STARTING TIME...' A BEGTIME R O 8 29EDTWRD(' 0: ') A 9 2'ENROLLMENT.....' A ENROLL R O 9 29EDTCDE(3) A 21 2'PRESS ENTER TO CONTINUE' A 23 2'F3=EXIT' A 23 11'F12=CANCEL'

23 Revised RPG code DFKeys DS D Exit 3 3N D Cancel 12 12N D SectNotFnd 90 90N C DOW NOT Exit C EXFMT Sect1 C IF NOT Exit C Section CHAIN Sections C EVAL SectNotFnd = NOT %FOUND(Sections) C IF %FOUND(Sections) C EXFMT Sect2 C ENDIF C ENDDO

24 Interactive File Maintenance  Adding, changing or deleting records instantly.  Must verify data validity  Three methods of safeguarding  Validation Keywords in PF description  Validation Keywords in Display file description  Validating values in program


Download ppt "Advanced RPG Chapter 8 Interactive Applicatons. Interactive Applications  Batch Processing: Program is run without human intervention or control.  Interactive."

Similar presentations


Ads by Google