CL programming (with Display Files). Review Display Files Constants Input/Output fields Attributes Activating Function keys.

Slides:



Advertisements
Similar presentations
Making Choices in C if/else statement logical operators break and continue statements switch statement the conditional operator.
Advertisements

Advanced RPG Chapter 8 Interactive Applicatons. Interactive Applications  Batch Processing: Program is run without human intervention or control.  Interactive.
CL Programming with Database Files Updated Fall 2010.
Introduction to Unix – CS 21 Lecture 11. Lecture Overview Shell Programming Variable Discussion Command line parameters Arithmetic Discussion Control.
1 Kevin Forsythe DMC Consulting What’s New In CL Programming.
Switch structure Switch structure selects one from several alternatives depending on the value of the controlling expression. The controlling expression.
Chapter 5: Loops and Files.
Flow of Control MINS298c Fall 1998 Chapter 9. Overview ABAP Programming Structures for: –Iteration –Decisions Control Flow –If … Then –Do & While loops.
Understanding SAS Data Step Processing Alan C. Elliott stattutorials.com.
chipKit Sense Switch & Control LED
Any Questions!. Agenda Fun with Functions –how to get the system date Condition Names INDARA and SI Iteration Logical Files Positioning the file pointer.
1 Operating Systems Lecture 3 Shell Scripts. 2 Shell Programming 1.Shell scripts must be marked as executable: chmod a+x myScript 2. Use # to start a.
PMS /134/182 HEX 0886B6 PMS /39/80 HEX 5E2750 PMS /168/180 HEX 00A8B4 PMS /190/40 HEX 66CC33 By Adrian Gardener Date 9 July 2012.
®® Microsoft Windows 7 for Power Users Tutorial 13 Using the Command-Line Environment.
While Loops Indefinite Iteration. Last lesson we looked at definite loops using the ‘For’ statement. The while loop keeps going while some condition is.
Chapter 4: Decision Making with Control Structures and Statements JavaScript - Introductory.
Lecture 4 Introduction to Programming. if ( grade ==‘A’ ) cout
SAS Efficiency Techniques and Methods By Kelley Weston Sr. Statistical Programmer Quintiles.
1 © 2001 John Urrutia. All rights reserved. Chapter 10 using the Bourne Again Shell.
Shell Programming. Creating Shell Scripts: Some Basic Principles A script name is arbitrary. Choose names that make it easy to quickly identify file function.
Set path vs current schema. Set Current Schema ‘The CURRENT SCHEMA special register specifies a VARCHAR(128) value that identifies the schema name used.
Open a editor Write/Type the program Save the program with “.c” extension Compile the program (alt + F9) Run/Execute the program (ctrl + F9) Check the.
Additional Control Structures. Chapter 9 Topics Switch Statement for Multi-way Branching Do-While Statement for Looping For Statement for Looping Using.
Creating PHPs to Insert, Update, and Delete Data CS 320.
Previously Repetition Structures While, Do-While, For.
1 Do-While Statement Is a looping control structure in which the loop condition is tested after each iteration of the loop. SYNTAX do { Statement } while.
Lecture 4 Looping. Building on the foundation Now that we know a little about  cout  cin  math operators  boolean operators  making decisions using.
IBC233 Calling Programs Updated Summer Agenda Assignments are mandatory Assignment 2 due on July 13, 2007 Display files – lower case Display files.
CIS4368: Advanced DatabaseSlide # 1 PL/SQL Dr. Peeter KirsSpring, 2003 PL/SQL.
Chapter 05 (Part III) Control Statements: Part II.
Chapter 3 Functions, Events, and Control Structures JavaScript, Third Edition.
IBC233 Lecture 2 Updated Winter 2008 Agenda Test next Week – Jan 23 ISeries Architecture CL (Control Language) Library Lists Operations Navigator.
(A Very Short) Introduction to Shell Scripts CSCI N321 – System and Network Administration Copyright © 2000, 2003 by Scott Orr and the Trustees of Indiana.
CSCE 121: Introduction to Program Design and Concepts Dr. J. Michael Moore Spring 2015 Set 4: Computation 1 Based on slides created by Bjarne Stroustrup.
Week 4 presentation! This week we will cover editing and the use of the on-board tools provided, SEU and PDM.
JavaScript, Fourth Edition
©Colin Jamison 2004 Shell scripting in Linux Colin Jamison.
Loops cause a section of a program to be repeated a certain number of times. The repetition continues while a condition remains true. When a condition.
Shell Programming Features “Full” programming language “Full” programming language Conditional statements Conditional statements Arithmetic, String, File,
Introduction to BASIC Programming Ken R. Hall, Ph.D. Ken R. Hall Consultants Portland, Oregon.
Introduction to Perl. What is Perl Perl is an interpreted language. This means you run it through an interpreter, not a compiler. Similar to shell script.
Loops and Files. 5.1 The Increment and Decrement Operators.
A loop is a repetition control structure. body - statements to be repeated control statement - decides whether another repetition needs to be made leading.
A First Book of C++: From Here To There, Third Edition2 Objectives You should be able to describe: The while Statement cin within a while Loop The for.
A FIRST BOOK OF C++ CHAPTER 5 REPETITION. OBJECTIVES In this chapter, you will learn about: The while Statement Interactive while Loops The for Statement.
A First Book of C++ Chapter 5 Repetition.
 Control Flow statements ◦ Selection statements ◦ Iteration statements ◦ Jump statements.
Chapter 15 Strings as Character Arrays
© The McGraw-Hill Companies, 2006 Chapter 3 Iteration.
Chapter 5 Repetition. 2 Objectives You should be able to describe: The while Statement cin within a while Loop The for Statement The do Statement Common.
1 Programming in C++ Dale/Weems/Headington Chapter 9 Additional Control Structures (Switch, Do..While, For statements)
2: Basics Basics Programming C# © 2003 DevelopMentor, Inc. 12/1/2003.
LECTURE # 8 : REPETITION STATEMENTS By Mr. Ali Edan.
Mindstorm NXT-G Introduction Towson University Robotics.
Engineering Computing I Chapter 3 Control Flow. Chapter 3 - Control Flow The control-flow of a language specify the order in which computations are performed.
Batch Files More flow of control Copyright © by Curt Hill.
1 Week # 5 Agenda CL Programming CL Commands Job Logs Review for test # 1.
C++ Programming: CS102 LOOP. Not everything that can be counted counts, and not every thing that counts can be counted. −Albert Einstein Who can control.
1 Lecture 8 Shell Programming – Control Constructs COP 3353 Introduction to UNIX.
CL Programming with Database Files Updated Summer 2007.
ECE Application Programming
When I want to execute the subroutine I just give the command Write()
Week 4 Updated Winter 2011.
Loops A loop is a repetition control structure.
Chapter 2.1 Repetition.
EECE.2160 ECE Application Programming
EECE.2160 ECE Application Programming
IBC233 Lecture 3 Updated Fall 2011
What’s New In CL Programming
CL programming (with Display Files)
Presentation transcript:

CL programming (with Display Files)

Review Display Files Constants Input/Output fields Attributes Activating Function keys

How do we use the Display File? They are included in programs. The programs use them to communicate with the user ( i.e. information is passed back and forth between the program and the user via the display file.)

Program Flow Display the Screen While not F3 Process Data Display the Screen Exit

CL Programming Restrictions Only five *FILE per program –Display file or Database File Can’t update Database Files Can’t create reports

CL Variables Datatypes = *CHAR, *DEC, *LGL, *INT, *UINT Variable names start with an ‘&’ e.g. &IN03, &CTR, &USER, &DATE, &MARK1, etc. DCL VAR(&varname) TYPE(*CHAR) LEN(8) variables must be declared before you can use them) variables from a display file will automatically be available to program. CHGVAR VAR(&varname) VALUE(value)

Examples DCL VAR(&TOTAL) TYPE(*DEC) LEN(7,2) DCL VAR(&GRADE) TYPE(*CHAR) LEN(1) CHGVAR VAR(&GRADE) VALUE (‘A’) CHGVAR VAR(&TOTAL) VALUE(&TOTAL + 1)

Some File Commands DCLF - Declares a File (files must be declared before you can use them) e.g. DCLF FILE(MARKSDF) SNDRCVF - Sends a record to a screen and waits for the user to enter input, then reads it (only for Display Files) - used with input/output screens e.g. SNDRCVF(MARKSDF)

Selection and Iteration IF (condition) THEN (command) ELSE for conditions, *AND, *OR, *NOT, *LT, *GT, *EQ, *NL, *NG, etc DO and ENDDO - used when you need to execute several commands in an IF statement GOTO and labels

IF, THEN, ELSE example IF COND(&TIME *LE ) + THEN ( SNDMSG MSG('Good Morning') TOUSR(DC233A40) ) ELSE + CMD( SNDMSG MSG('Good Afternoon') TOUSR(DC233A40 ) )

DO, ENDDO example IF (&CHOICE = 'O' *OR &CHOICE = 'o') + DO CHGCURLIB IBC233LIB WRKOBJPDM IBC233LIB ENDDO ELSE (GOTO END) END: ENDPGM

Select Group SELECT WHEN COND(&TYPE *EQ *CMD) THEN(DO) (group of CL commands) ENDDO WHEN COND(&TYPE = *PGM) THEN(DO) (group of CL commands) ENDDO OTHERWISE CMD(CHGVAR &BADTYPE ‘1’) ENDSELECT

DOWHILE Loop SNDRCVF DOWHILE(&IN03 *NE ‘1’) IF (&IN05 *EQ ‘1’) + DO CHGVAR VAR(&MARK1) VALUE(0) CHGVAR VAR(&MARK2) VALUE(0) ENDDO SNDRCVF ENDDO WRKOBJPDM This bit of code sends the display file to the screen and reads it back. If F3 is pressed, the loop exits and WRKOBJPDM is done. If not, It then checks to see if the user has pressed F5. If so, it initializes the 2 fields MARK1 and MARK2 and redisplays the screen.

DOUNTIL Loop SNDRCVF DOUNTIL(&IN03) /* the contents of loop is */ IF (&IN05) + /* always processed once */ DO CHGVAR VAR(&MARK1) VALUE(0) CHGVAR VAR(&MARK2) VALUE(0) ENDDO SNDRCVF ENDDO WRKOBJPDM This bit of code sends the display file to the screen and reads it back. If F3 is pressed, the loop exits and WRKOBJPDM is done. If not, It then checks to see if the user has pressed F5. If so, it initializes the 2 fields MARK1 and MARK2 and redisplays the screen.

DOFOR Loop DCL &LOOPCTL TYPE(*INT) LEN(4) DCL &LOOPLMT TYPE(*INT) LEN(4) DOFOR VAR(&LOOPCTL) FROM(1) TO(&LOOPLMT) BY(1) (group of commands run 0 or more times) ENDDO

Indicators Indicators are on/off switches used by programs. 2 possible values: 1 or 0 – Response indicators : set by functions keys, used by programs to determine the appropriate response e.g. exit when F3 is pressed – Option indicators : set by programs, used to control when/how info is displayed e.g. an indicator is set to on when an error is detected causing an data field to be displayed in red.

Program Flow using Screens and Indicators SNDRCVF Check response indicators DOWHILE (&IN03 *NE ‘1’) Edit input, set option indictors If (&name = ‘ ‘) chgvar IN30 ‘1’ SNDRCVF Exit

Examples of Response Indicator use If (&in03 *eq ‘1’) + goto cmdlbl(exit) If (&in05 * eq ‘1’) + do chgvar var(&assign1) value ( 0 ) chgvar var(&assign2) value ( 0 ) goto cmdlbl(read) enddo

Examples of Option Indicator Use IF (&ASSIGN1 *LT 0 *OR &ASSIGN1 *GT 5) + CHGVAR VAR( &IN30) VALUE (‘1’) IF (&ASSIGN2 *LT 0 *OR &ASSIGN2 *GT 10) + CHGVAR VAR (&IN31) VALUE (‘1’) IF (&IN30 *OR &IN31) + GOTO CMDLBL(SEND) /* REDISPLAY SCREEN */

/* sample */ DCLF FILE(ORDERDF) SNDRCVF DOWHILE (&IN03 *NE ‘1’) IF (&ORDERNO *LE 0) + CHGVAR VAR (&IN40 ) VALUE ( ‘1’ ) IF (&ORDDESC *EQ ‘ ‘) + CHGVAR VAR (&IN41 ) VALUE ( ‘1’) IF ( &IN40 *OR &IN41 ) + GOTO CMDLBL(NEXT) CALL CBLPGM ( &ORDERNO &ORDDESC ) NEXT:SNDRCVF ENDDO ENDPGM