Any Questions!. Agenda Fun with Functions –how to get the system date –How to get the next service date INDARA and SI Condition Names Iteration Logical.

Slides:



Advertisements
Similar presentations
DT266/2 Information Systems COBOL Revision. Chapters 1 & 2 Hutty & Spence Divisions of a Cobol Program Identification Division Program-ID. Environment.
Advertisements

iSeries Database Files
CL Programming with Database Files Updated Fall 2010.
Files Organisation sequential files. Readings u Schneider Chapter 8 u Shelly Cashman to 9.14; to 9.11 u Meyer to 2-37; 1995.
Processing with VSAM Files Please use speaker notes for additional information!
Display a 12-Month Calendar CS-2301 D-term Programming Assignment #2 12-Month Calendar CS-2301 System Programming C-term 2009 (Slides include materials.
January 2012 Monday Tuesday Wednesday Thursday Friday Sat/ Sun / /8 14/15 21/22 28/
Chapter 5: Loops and Files.
Assignment #2, 12- month Calendar CS-2301, B-Term Programming Assignment #2 12-Month Calendar CS-2301, System Programming for Non-Majors (Slides.
21 August (B.V.Patel institute of BMC & IT) STRUCTURE AND UNIONS.
Any Questions!. Agenda Fun with Functions –how to get the system date Condition Names INDARA and SI Iteration Logical Files Positioning the file pointer.
4-1 Coding Complete COBOL Programs: The PROCEDURE DIVISION Chapter 4.
4-1 COBOL for the 21 st Century Nancy Stern Hofstra University Robert A. Stern Nassau Community College James P. Ley University of Wisconsin-Stout (Emeritus)
4-1 COBOL for the 21 st Century Nancy Stern Hofstra University Robert A. Stern Nassau Community College James P. Ley University of Wisconsin-Stout (Emeritus)
Agenda Control Flow Statements Purpose test statement if / elif / else Statements for loops while vs. until statements case statement break vs. continue.
1 Chapter 4. To familiarize you with methods used to 1. Access input and output files 2. Read data from an input file 3. Perform simple move operations.
Chapter To familiarize you with  Why COBOL is a popular business-oriented language.  Programming practices and techniques  History of COBOL.
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.
Logic Structure - focus on looping Please use speaker notes for additional information!
Lecture 31 Numeric Edited Alphabetic (A) AlphaNumeric (X) Numeric (9, V, S) Numeric Edited (9, Z, comma, decimal point, minus sign) –Z = zero suppressed.
The DATA DIVISION Chapter 3. COBOL Data Organization Field - group of characters forming a meaningful unit or basic fact –Characters in a name or digits.
3-1 Chapter 3. To familiarize you with  Ways in which data is organized in COBOL  Rules for forming data-names  Defining input and output files in.
1 Interactive vs Batch Programs Cobol suited for developing both types of programs Interactive programs Accept input data from keyboard Input data processed.
Printing on power systems Program/ Command Data Report Layout (Printer File) Job Output Queue *FILE Spooled File.
Chapter 7 File I/O 1. File, Record & Field 2 The file is just a chunk of disk space set aside for data and given a name. The computer has no idea what.
Set path vs current schema. Set Current Schema ‘The CURRENT SCHEMA special register specifies a VARCHAR(128) value that identifies the schema name used.
Indexed and Relative File Processing
Statement Syntax1 THE SELECT STATEMENT Purpose: designates a file and points to its physical location Syntax Definition : SELECT file-name-1 ASSIGN TO.
CPSC3111/CISM3111 COBOL Structured COBOL Programming Text: murach’s structured COBOL Authors: Murach, Prince, Menendez.
9-1 COBOL for the 21 st Century Nancy Stern Hofstra University Robert A. Stern Nassau Community College James P. Ley University of Wisconsin-Stout (Emeritus)
9-1 Iteration: Beyond the Basic PERFORM Chapter 9.
Structured COBOL Programming Nancy Stern Hofstra University Robert A. Stern Nassau Community College James P. Ley University of Wisconsin-Stout.
An Introduction to Programming with C++ Sixth Edition Chapter 14 Sequential Access Files.
Garside: SNC2D. The following schedule is for Period 2 Class:
Any Questions!. Test Coming Up! Agenda Printing with Externally Described Printer Files Arrays.
A loop is a repetition control structure. body - statements to be repeated control statement - decides whether another repetition needs to be made leading.
1 Chapter 9. To familiarize you with  Simple PERFORM  How PERFORM statements are used for iteration  Options available with PERFORM 2.
 In computer programming, a loop is a sequence of instruction s that is continually repeated until a certain condition is reached.  PHP Loops :  In.
Loops and Files. 5.1 The Increment and Decrement Operators.
This is It! It’s been a pleasure! Final Exam – format True / false 5 Multiple choice 5 Short answers10 Data manipulation10 SQL 3 Array’s12 File processing25.
Analysis of SAMPLE1.CBL Please check speaker notes for additional information!
Chapter 4 PROCEDURE DIVISION. Paragraphs PROCEDURE DIVISION divided into paragraphs Each is independent module or routine Made up of series of instructions.
Any Questions!. Agenda Fun with Functions Externally Described Files Condition Names Iteration Logical Files Random Reads.
Week 2/3 - 2nd Lecture Intro to COBOL Programming Defining Files and Processing Data.
Copyright © 2013 Pearson Education, Inc. Publishing as Pearson Addison-Wesley Starting Out with Programming Logic & Design Third Edition by Tony Gaddis.
Lab Test 2 Session 1 Date: Friday, December 3 Time: 2:30 - 4:20 (110 minutes) Locations: - Lab 1006 (for Friday students) - Lab 1004 (for Monday students)for.
FILES AND EXCEPTIONS Topics Introduction to File Input and Output Using Loops to Process Files Processing Records Exceptions.
Sorting in COBOL M. M. Pickard.
COSC 5V90 Functional Programming and Interactive Theorem Proving
How’s assignment 1 coming? Winter 2007
IBC233 Week 6.
Think What will be the output?
Designing and Debugging Batch and Interactive COBOL Programs
Any Questions?.
Chapter 3 The DATA DIVISION.
Agenda Test next Week! SI or no SI? File Update Techniques – Review.
2017 Jan Sun Mon Tue Wed Thu Fri Sat
Chapter 14 Sorting and Merging.
Iteration: Beyond the Basic PERFORM
January Sun Mon Tue Wed Thu Fri Sat
Programming in COBOL-85 For IBM Mainframe System 390
Agenda Collating sequence / Sorting data
Jan Sun Mon Tue Wed Thu Fri Sat
Sun Mon Tue Wed Thu Fri Sat
Sun Mon Tue Wed Thu Fri Sat

2016 | 10 OCT SUN MON TUE WED THU FRI SAT
Sun Mon Tue Wed Thu Fri Sat
IBC233 Week 5.
Presentation transcript:

Any Questions!

Agenda Fun with Functions –how to get the system date –How to get the next service date INDARA and SI Condition Names Iteration Logical Files Positioning the file pointer

Fun with Functions ILEFUNCT

Condition Names Used with Code Fields –Eg. ARE-THERE-MORE-RECORDS –Eg. FINAL-GRADE –Eg. Indicators

Condition Names 01 ARE-THERE-MORE-RECORDS PIC X(3) VALUE ‘YES’. 88 THERE-ARE-MORE-RECORDS VALUE ‘YES’. 88 END-OF-FILEVALUE ‘NO’. IF THERE-ARE-MORE-RECORDS READ EMPLOYEE-FILE. IF END-OF-FILE PERFORM TERMINATION-RTN.

Set Verb Used to initialize fields to a Condition- Name. 01 ARE-THERE-MORE-RECORDS PIC X(3). 88 THERE-ARE-MORE-RECORDS VALUE ‘YES’. 88 END-OF-FILEVALUE ‘NO’. SET END-OF-FILE TO TRUE.

Conditions Cont’d 01 WORK-DAYS PIC X(3). 88 MONDAY VALUE ‘MON’. 88 TUESDAY VALUE ‘TUE’. 88 WEDNESDAY VALUE ‘WED’. 88 THURSDAY VALUE ‘THU’ 88 FRIDAY VALUE ‘FRI’. SET MONDAY TO TRUE. IF FRIDAY DISPLAY ‘GO HOME EARLY’.

Conditions Cont’d 01 FALL-MONTHS PIC X(3). 88 SEPTEMBER VALUE ‘SEP’. 88 OCTOBER VALUE ‘OCT’. 88 NOVEMBERVALUE ‘NOV’. 88 DECEMBER VALUE ‘DEC’. IF OCTOBER DISPLAY ‘HAPPY HALLOWEEN!!’ SET DECEMBER TO TRUE.

Option Indicators and Conditions 01 WS-indicators. 05 IN90 INDICATOR 90 PIC display-message value B’1’. 88 dont-display-message value B’0’. Set display-message to true. Set dont-display-message to true. If display-message If don’t-display-message If not display-message

Response Indicators and Conditions 01 WS-Control. 05 ws-function-key pic x(2). 88 F3 value ’03’ 88 F12 value ’12’. 88 Enter value ’00’ 05 ws-device-name pic x(10). 05 ws-record-format pic x(10). If F3 If not F3

Iteration Looping

BASIC Perform Statement PERFORM (paragraph-name)

Basic PERFORM READ Emp-File PERFORM DSP-Rtn STOP RUN DSP-RTN move emp-in to emp- out. write dsp-record format is ‘SCREEN’. read dsp-file record.

PERFORM Until PERFORM paragraph-name UNTIL Condition

PERFORM Until Condition Met? Execute Program Statements NO YES

PERFORM Until READ Emp-File AT END Move ‘YES’ TO EOF. PERFORM Dsp-Rtn UNTIL EOF = ‘Y’ STOP RUN DSP-RTN move emp-in to emp-out. write dsp-record format is ‘SCREEN’. read dsp-file RECORD. read emp-file at end move ‘YES’ to EOF.

PERFORM X Times PERFORM (paragraph-name) THROUGH/THRU (paragraph-name) (integer/variable) TIMES

PERFORM X Times Number of Times Met? Execute Program Statements NO YES

PERFORM X Times READ Emp-File AT END Move ‘YES’ TO EOF. PERFORM Dsp-Rtn 5 TIMES STOP RUN DSP-RTN move emp-in to emp- out. write dsp-record format is ‘SCREEN’. read dsp-file record.

PERFORM With Test After PERFORM (paragraph-name) THROUGH/THRU (paragraph-name) WITH TEST AFTER UNTIL Condition

PERFORM With Test After Condition Met? Execute Program Statements NO YES

PERFORM With Test After READ Emp-File AT END Move ‘YES’ TO EOF. PERFORM Dsp-Rtn WITH TEST AFTER UNTIL EOF = ‘Y’ STOP RUN DSP-RTN move emp-in to emp-out. write dsp-record format is ‘SCREEN’. read dsp-file record. read emp-file AT END MOVE ‘YES’ TO EOF.

PERFORMs within PERFORMs READ Emp-File AT END Move ‘YES’ TO EOF. PERFORM DSP-Rtn UNTIL 5 TIMES STOP RUN DSP-RTN MOVE EMP-IN TO EMP-OUT. PERFORM Write-Rtn

Iteration Statement to Use? Perform Until –Tests for the condition first –Statements are executed only if the condition is true Perform With Test After –tests for the condition last –Statements are always executed at least once

Iteration Statement to Use? Perform X Times –Use this when you know the number of times the paragraph(s) are to be executed.

Sorting Data Using Access Paths

Physical Files vs Logical Files EMPLOYEEPF *FILE EMPLOYEE *FILE Physical Files or Logical Files?

Externally Described Files Select Statement when physical/logical file has a key. SELECT Cobol-file-name ASSIGN TO database-actual-file-name [ORGANIZATION IS INDEXED] [ACCESS MODE IS SEQUENTIAL] RECORD KEY is data-element. (data-element could be EXTERNaLLY-DESCRIBED-KEY)

Externally Described Files Copying the record layout. FD Cobol-file-name. 01 Cobol-Record-Name. COPY DD-actualrecordname OF actualfilename. (DD can be replaced by DDS if you require the 10 char field names instead of the aliases)

Handy Physical File Commands DSPPFM – Display Physical File Member Displays the contents of a Physical File in arrival sequence. DSPFD – Display File Description Information about the file – eg access path. DSPFFD – Display File Field Description Displays the fields in the file.

Positioning the File Pointer Start Verb

Used only with Sequentially defined files. Initialize the record key START file-name Key Condition INVALID KEY Perform Invalid-Logic NOT INVALID KEY Perform valid-logic END-START.