Through this way, development works such as coding and debugging would be easier. Program modularization is the process of decomposing a program into smaller manageable group of codes with specific objectives. ** Example 'RPTEX1S': REPEAT (structured mode) ************************************************************************ DEFINE DATA LOCAL 1 EMPLOY-VIEW VIEW OF EMPLOYEES 2 PERSONNEL-ID 2 NAME * 1 #PERS-NR (A8) END-DEFINE * REPEAT INPUT 'ENTER A PERSONNEL NUMBER:' #PERS-NR IF #PERS-NR = ' ' ESCAPE BOTTOM END-IF /* FIND EMPLOY-VIEW WITH PERSONNEL-ID = #PERS-NR IF NO RECORD FOUND REINPUT 'NO RECORD FOUND' END-NOREC DISPLAY NOTITLE NAME END-FIND END-REPEAT * END (2) Program Modularization The search task will be repeated until the computer user decides to terminate it i.e. Here, the computer user is requested to enter an employee number for the computer so that it can initiate a database search task. The following example (refer Nat914win repeat) demonstrates the use of loop structure to repeat certain computer processing tasks. eliminating unnecessary statement redundancies. Repetition structure helps to optimize the arrangement of instruction statements i.e. FIND EMPLOY-VIEW WITH CITY = 'FRANKFURT' SORTED BY NAME BIRTH IF SALARY (1) LT 40000 WRITE NOTITLE '*****' NAME 30X 'SALARY LT 40000' ELSE IF BIRTH GT #BIRTH FIND VEHIC-VIEW WITH PERSONNEL-ID = PERSONNEL-ID (FND.) DISPLAY (IS=ON) NAME BIRTH (EM=YYYY-MM-DD) SALARY (1) MAKE (AL=8) END-FIND END-IF END-IF END-FIND ENDĪ Loop Control Structure is used to repeat the execution of certain instruction statements. This program applies a Nested IF-ELSE structure to support its complex query condition branches. In this example, the program is instructed to find employees who are located in the city ‘FRANKFURT’ and, if their salaries are greater than 40,000 and their birth dates are after 1st January 1945, print their name, their birth date, their salary and their vehicle’s make. The following example (refer Nat914win if) demonstrates the use of the Selection Control Structure. the instruction statements are arranged by one after another. Most programs by default start with the Sequential Control Structure i.e. (refer here to get Natural NSD format files for the above items). (3) Adabas DDM for EMPLOYEES and VEHICLES database files. (refer here to read the setup guide for the above items). PRE-REQUISITE: (1) ADABAS and NATURAL Server Community Edition (Docker Version). The code examples are taken from the Nat914win official documentation (refer Nat914win fs-about). This post describes the application of Structured Programming approach in building mainframe database programs using ADABAS database and NATURAL programming language. Moreover, program codes are decomposed into small manageable chunks aka modularization. This involves the use of Program Control Structures such as Sequential, Selection and Loop. We have to find a sorted list of all the integers in the range inclusive that have sequential digits.Structured Programming approach is a technique to improve program codes reliability and clarity (refer Hunt 1979). Suppose we have an integer, that has sequential digits if and only if each digit in the number is one more than the previous digit.
0 Comments
Leave a Reply. |
AuthorWrite something about yourself. No need to be fancy, just an overview. ArchivesCategories |