140 likes | 366 Views
JACKSON Structured Programming. It was developed by Michael Jackson – it is a systematic technique for mapping the structure of a problem into program structure. The mapping is accomplished in 3 steps. Specifying input and output data structures using tree structured diagrams
E N D
It was developed by Michael Jackson – it is a systematic technique for mapping the structure of a problem into program structure
The mapping is accomplished in 3 steps • Specifying input and output data structures using tree structured diagrams • Identify the correspondence between nodes in the output and input trees • The structural model of the program is expanded into a detailed design model that contains the operations needed to solve the problem
Input and output structure are specified using a graphical notation to specify data hierarchy Sequences of data Repetition of data items alternate data items
A First Step : Tree Structure B C D E F G H I
Second Step • Identify the points of commonality in the input and output structure and combining the two structures into a program structure
Third Step It has 3 sub steps 1) A list of operations required to perform the processing steps is developed 2) The operations are associated with the program structure 3) Program structure and operations are expressed in a notation called schematic logic, which is stylized pseudo code. Control flow for selection and iteration are specified in this step.
Example • Input file – collection of inventory records sorted by part number • Part number – each record contains it (field). It’s the number of units of that item issued or received in one transaction • Output record - contains heading and Net movement line for each part number in the input file • Because the input file is sorted by part number, all issues and receipts of a given part number are in a contiguous portion of the file called a part group. • Each record in the part group is called a movement record.
Step 1: Tree Structure (i/o struct) Input file Output Record Part Group Heading Body Movement Record Net Movement Line Issue Receipt
Step 2: Correspondence Input file Output Record Part Group Heading Body Movement Record Net Movement Line Issue Receipt
After corresponding the resultant structure will be as follows: It’s a program structure for an inventory problem program Process heading Process Body Process PTGP and Line Process PTGP body Process Line Process Record Process issue Process Receipt
Step3 : Sub Step1 List of Operations needed in the inventory program • Open Files • Close Files • Stop Run • Read a record into PART_NUM,MOVMNT • Write Heading • Write NET_MOVEMENT Line • Set Net_Movmnt to zero • Add MovMnt to Net_Movmnt • Subtract movmnt from net_movment
Sub Step 2 (Association of Operations) program Process heading Process Body 2 3 1 4 5 Process PTGP and Line Process PTGP body Process Line 7 6 Process Record 4 9 Process issue Process Receipt 8
Sub Step 3 (Schematic Logic Representation) BEGIN PROGRAM OPEN FILES READ PART_NUM, MOVMNT WRITE HEADING ITERATE WHILE NOT(END-OF-FILE) SET NET-MOVMNT TO ZERO ITERATE WHILE SAME-PART-NUM IF (MOVMNT= ISSUE) THEN SUB MOVMNT FROM NET-MOVMNT ELSE IF (MOVMNT = RECEIPT) THEN ADD MOVMNT TO NET-MOVMNT END IF READ PART-NUM,MOVMNT END WHILE WRITE NET-MOVEMENT LINE END WHILE CLOSE FILES STOP END PROGRAM