Application Development Single Source Updates at KLM and tools used The Highlights Michael Bahlen TPF user group Dallas - 15 April 2008.

Slides:



Advertisements
Similar presentations
C Language.
Advertisements

R4 Dynamically loading processes. Overview R4 is closely related to R3, much of what you have written for R3 applies to R4 In R3, we executed procedures.
Macro Processor.
Lecture 2 Introduction to C Programming
COSC 120 Computer Programming
Bellevue University CIS 205: Introduction to Programming Using C++ Lecture 3: Primitive Data Types.
Computer Programming and Basic Software Engineering 4. Basic Software Engineering 1 Writing a Good Program 4. Basic Software Engineering 3 October 2007.
Chapter 3 Program translation1 Chapt. 3 Language Translation Syntax and Semantics Translation phases Formal translation models.
CS 104 Introduction to Computer Science and Graphics Problems Software and Programming Language (2) Programming Languages 09/26/2008 Yang Song (Prepared.
CMSC 104, Version 9/011 Introduction to C Topics Compilation Using the gcc Compiler The Anatomy of a C Program 104 C Programming Standards and Indentation.
Introduction to C Topics Compilation Using the gcc Compiler
Introduction to C. A Brief History Created by Dennis Ritchie at AT&T Labs in 1972 Originally created to design and support the Unix operating system.
CMSC 104, Version 8/061L18Functions1.ppt Functions, Part 1 of 4 Topics Using Predefined Functions Programmer-Defined Functions Using Input Parameters Function.
HBar OR Reader Documentation A copy of the PowerPoint Viewer is shipped with the HBar OR Reader on the HBar Official Records [OR] CD. The PowerPoint Viewer.
Recap, Test 1 prep, Composition and Inheritance. Dates Test 1 – 12 th of March Assignment 1 – 20 th of March.
CMPSC 16 Problem Solving with Computers I Spring 2014 Instructor: Lucas Bang Lecture 15: Linked data structures.
Dr Masri Ayob TK 2633: Microprocessor & Interfacing Lecture 7: Assembly Language.
Introduction to Visual Basic. Quick Links Windows Application Programming Event-Driven Application Becoming familiar with VB Control Objects Saving and.
© The McGraw-Hill Companies, 2006 Chapter 4 Implementing methods.
C Programming Tutorial – Part I CS Introduction to Operating Systems.
Separate Compilation. A key concept in programming  Two kinds of languages, compilation (C, Pascal, …) and interpretation (Lisp, …, Matlab, Phython,
The Structure of a C++ Program. Outline 1. Separate Compilation 2. The # Preprocessor 3. Declarations and Definitions 4. Organizing Decls & Defs into.
Programming With C.
CMSC 104, Version 9/011 Introduction to C Topics Compilation Using the gcc Compiler The Anatomy of a C Program 104 C Programming Standards and Indentation.
Operating Systems Lecture 7 OS Potpourri Adapted from Operating Systems Lecture Notes, Copyright 1997 Martin C. Rinard. Zhiqing Liu School of Software.
Chapter 13. Procedural programming vs OOP  Procedural programming focuses on accomplishing tasks (“verbs” are important).  Object-oriented programming.
The LC-3 – Chapter 7 COMP 2620 Dr. James Money COMP
Fundamentals of C and C++ Programming. EEL 3801 – Lotzi Bölöni Sub-Topics  Basic Program Structure  Variables - Types and Declarations  Basic Program.
CPSC 230 Computers and Programming I Spring 2003 Dr. Lynn Lambert.
Algorithms  Problem: Write pseudocode for a program that keeps asking the user to input integers until the user enters zero, and then determines and outputs.
1 FUNCTIONS - I Chapter 5 Functions help us write more complex programs.
Blackfin Array Handling Part 1 Making an array of Zeros void MakeZeroASM(int foo[ ], int N);
1 CS503: Operating Systems Spring 2014 Part 0: Program Structure Dongyan Xu Department of Computer Science Purdue University.
C++ LANGUAGE TUTORIAL LESSON 1 –WRITING YOUR FIRST PROGRAM.
CPS120: Introduction to Computer Science Compiling a C++ Program From The Command Line.
What am I? while b != 0 if a > b a := a − b else b := b − a return a AST == Abstract Syntax Tree.
Object Oriented Software Development 4. C# data types, objects and references.
CS1201: PROGRAMMING LANGUAGE 2 FUNCTIONS. OVERVIEW What is a Function? Function Prototype Vs Decleration Highlight Some Errors in Function Code Parameters.
Separate Compilation Bryce Boe 2013/10/09 CS24, Fall 2013.
C LANGUAGE Characteristics of C · Small size
Chapter 6: Function Introduction to function Standard functions User defined functions –function prototype –function definition Function call Storage classes.
Assembly 08. Outline Local Labels Jump Lengths External Libraries Macros 1.
© Oxford University Press All rights reserved. CHAPTER 10 THE PREPROCESSOR DIRECTIVE.
© 2008, Renesas Technology America, Inc., All Rights Reserved 1 Introduction Purpose  This training course demonstrates the Project Generator function.
Preocedures A closer look at procedures. Outline Procedures Procedure call mechanism Passing parameters Local variable storage C-Style procedures Recursion.
LECTURE 3 Translation. PROCESS MEMORY There are four general areas of memory in a process. The text area contains the instructions for the application.
L071 Introduction to C Topics Compilation Using the gcc Compiler The Anatomy of a C Program Reading Sections
Editing and Debugging Mumps with VistA and the Eclipse IDE Joel L. Ivey, Ph.D. Dept. of Veteran Affairs OI&T, Veterans Health IT Infrastructure & Security.
7-Nov Fall 2001: copyright ©T. Pearce, D. Hutchinson, L. Marshall Oct lecture23-24-hll-interrupts 1 High Level Language vs. Assembly.
Writing Functions in Assembly
Programming what is C++
User-Written Functions
Chapter 8: Programming the Microprocessor
Computer Science 210 Computer Organization
A bit of C programming Lecture 3 Uli Raich.
Functions Separate Compilation
Chapter 4 Addressing modes
Writing Functions in Assembly
C Basics.
Pre-processor Directives
Computer Science 210 Computer Organization
Compiler Construction
Generating the “Rectify” code (C++ and assembly code)
Handling Arrays Completion of ideas needed for a general and complete program Final concepts needed for Final.
C Preprocessor(CPP).
Programming Fundamentals Lecture #3 Overview of Computer Programming
Handling Arrays Completion of ideas needed for a general and complete program Final concepts needed for Final.
Handling Arrays Completion of ideas needed for a general and complete program Final concepts needed for Final.
Introduction to Computer Systems
Week 5 Computers are like Old Testament gods; lots of rules and no mercy. Joseph Campbell.
Presentation transcript:

Application Development Single Source Updates at KLM and tools used The Highlights Michael Bahlen TPF user group Dallas - 15 April 2008

2 Single Source at KLM Single Source Updates Excitement! z/TPF Applying Single Source So many times the same thing!

3 Single Source at KLM Single Source Updates Assembler programs -Calling C -Assembler linked into C C(++) programs -Packed structures -Packed decimal Testing -Stress test -User test Tools used

4 Single Source at KLM Single Source Updates Assembler calling C To avoid too much work we looked for a simple and quick method. At first it appeared to be a lot of work finding all ENTRC’s from assembler to C. It also looked like a lot of work to implement the CPROG and CALLC macro’s. Lucky enough IBM came with a simpler setup for this single source update: UPROC (Put 4 APAR PJ31214).

5 Single Source at KLM Single Source Updates UPROC in KLM In the UPROC we call another macro per sub-system. Inside these macro’s we call macro’s with the same name as the include headers that contain the C-prototype. MACRO UPROC COPY UPRMDW COPY UPRRES COPY UPRDCS COPY UPRCGO COPY UPRFIR COPY UPRSYS COPY UPRCOM MEND COPY AVLLNK COPY AVSLNK COPY BCELNK COPY COSLNK COPY DBULNK COPY DYNLNK COPY EDILNK COPY FDLLNK Etc. CPROC AVS5,(p,p),RETURN=ui CPROC AVSA,(p,p),RETURN=i CPROC KAVM,(),RETURN=void CPROC KAVS,(),RETURN=void

6 Single Source at KLM Single Source Updates Transfer vectors! BEGIN AMODE=31,NAME=PGMA B PGMA B PGMB BEGIN AMODE=31,NAME=PGMA, > TV=(PGMB,PGMC) * B PGMA * B PGMB Wrong! BEGIN AMODE=31,NAME=PGMA, > TV=(PGMB,PGMC) B PGMA B PGMB OK!

7 Single Source at KLM Single Source Updates Assembler linked into C What to change and how? That was my big question. OK I knew I had to change to prolog and epilog macro’s. But there was more to do! Parameters were coming in through a pointer in R1! Not anymore! Now it is in R2-R6! So the parameters used are now in registers! That meant I had to re-write most of the code, most of the registers had another usage!

8 Single Source at KLM Single Source Updates Registers R8 and R13 are to be watched very closely. Do this by usage of the PBASC and CSTCK macros. If 4K is not enough, use baseless programming, E.g. Jump and immediate instructions. I was able to make a library function under TPF41 of about 60K with only R8 on the 1 st 4K of the routine, the rest was baseless…

9 Single Source at KLM Single Source Updates old code PARMS DSECT PSTR DS F POINTER TO STRING TO CONVERT LL25 CSECT USING PARMS,R3 EXTRN STRUPR TMSPC LWS=R4 LR R3,R1 COPY INPUT POINTER L R1,PSTR GET POINTER TO STRING LR R6,R1 COPY FOR LATER L GET ADDRESS TRT TABLE NEXT EQU * TRT 0(256,R1),0(R2) GET ZERO TERMINATION BYTE BNE LAST FOUND! TR 0(256,R1),UPRTAB NOT FOUND YET, TRANSLATE THIS PART LA R1,256(R1) POINT TO NEXT PART LR R6,R1 COPY AGAIN FOR LATER B NEXT RE-START LAST EQU * SR R1,R6 CALCULATE LENGTH TO DO #EXEC R1,TR,0(0,R6),UPRTAB TRANSLATE THIS (LAST) PART L R15,PSTR POINTER TO RETURN TMSEC RC=R15 RETURN POINTER TO STRING

10 Single Source at KLM Single Source Updates new code STRUPR PRLGC FRAMESIZE=0,ENAME=STRUPR,AMODE=31, > BASE=R8,STACK=R13 SR R0,R0 LR R1,R2 For use in SRST instruction NEXT EQU * SRST R0,R2 Find end of the string JO NEXT Continue if not done SLR R0,R1 Calculate length of string LR R2,R1 Go back to start of string NEXTTR EQU * CHI R0,256 Length within range TR instruction JL LAST Yes, do last part LARL R4, UPRTAB Get address of translate table TR 0(256,R2),0(R4) Do 256 bytes and LA R2,256(R2) Point to the next characters and AHI R0,-256 Reduce length to be done J NEXTTR Next part LAST EQU * LTR R3,R0 Anything left? JNP END If not - we are done BCTR R3,0 Adjust for Execute EX R3,TRANS Do last part END EQU * EPLGC RC=R1 Return pointer to string

11 Single Source at KLM Single Source Updates APAR needed! If you use this Single Source, the original APAR contains an error that may results in a CTL-09400C dumps: ISO-C STACK OVERFLOW You also have to apply APAR PJ32314 of put 23!

12 Single Source at KLM Single Source Updates Packed structures Before Toolkit updates _Packed struct t_example { int x; }; After Toolkit updates #ifdef __370__ _Packed #endif struct t_example { int x; } #ifndef __370__ __attribute__((packed)) #endif ; Readability zero after updates!

13 Single Source at KLM Single Source Updates Even worse at KLM, we did not always use the _Packed keyword but used a definition of: #define Pstruct _Packed struct Which is not recognized by the toolkit, E.g.: Pstruct t_example { int x; }; So we needed another solution…

14 Single Source at KLM Single Source Updates We need new defines for TPF4.1 and zTPF1.1 In a generally used include header: #ifdef __370__ #define Pstruct _Packed struct #define Punion _Packed union #define _PACKED_ #else #define Pstruct struct #define Punion union #define _Packed #define _PACKED_ __attribute__((packed)) #endif

15 Single Source at KLM Single Source Updates Result is a good readable solution: Pstruct t_example { int x; } _PACKED_; _Packed struct t_example { int x; } _PACKED_; typedef Pstruct t_example _PACKED_ EXAMPLE; typedef _Packed struct t_example _PACKED_ EXAMPLE;

16 Single Source at KLM Single Source Updates For usage of #pragma pack, some updates are needed, but they are very simple: #pragma pack(pack) becomes #pragma pack(1) #pragma pack(reset) becomes #pragma pack() This is supported by the IBM C-compiler.

17 Single Source at KLM Single Source Updates Packed Decimal (in C) The packed decimal type we know in TPF4.1 does not exist in the GCC-compiler. Solution: A bunch of functions given by IBM. All we knew about them was there calling names, found in the TPF information center. But watch out, you’ll be using floats in your calculations (less accurate!). After some tests and searches on the internet we found what to do in our environment.

18 Single Source at KLM Single Source Updates Packed Decimal Other solutions: Use the proposed solution for C++ (type library), convert C-code to C++ (just say to the compiler that the C-code is C++). Your programmers need some C++ knowledge. Change the GCC compiler to recognize the decimal type. If you do so (its open source!) share it with all other TPF companies, by having it adapted into the standard GCC compiler!

19 Single Source at KLM Single Source Updates Testing Stress-test (live input over a TPF test-system with updated programs): We did several stress-tests to prove that the updates did not cause dumps, some of course did, so a new stress-test was needed. User-test : What to tell the user to test? How much time do they need? It all depends on the software updated, result so far: No errors on production system.

20 Single Source at KLM Single Source Updates Tools used At first the TPF toolkit (specially installed before the big roll-out) Later IdefixGui (adapted version, will be the zIdefixGui) Demo of the KLM tool.

21 Single Source at KLM Main display of IdefixGui with Demo Grip (collection of sources)

22 Single Source at KLM Select Single Source check for Complete Grip

23 Single Source at KLM GUI shows progress

24 Single Source at KLM Results are written to event file and shown through an event viewer

25 Single Source at KLM After double click Editor opens on place to change

26 Single Source at KLM For scanning sources that need Single Source, a special path search is included.

27 Single Source at KLM Result is also passed to the event viewer

28 Single Source at KLM For generating assembler prototype, a special function is created to generate the assembler file containing the CPROC statements

29 Single Source at KLM Assembler file before creation of CPROC statements

30 Single Source at KLM Assembler file after creation of CPROC statements

31 Single Source at KLM Single Source Updates Some advice Train your people before starting in Single Source. Do some tests with the toolkit and see what is missing for your way of working. Make a ‘complete’ list of adjustments to be done. Make workable standards for z/TPF compatible code. E.g. Always use typedef’s for structures Make your own scan tools?

32 Single Source at KLM Single Source Updates User exits IBM has many new user exits implemented. For us this results in renaming programs. We knew this may happen, but we never took the time to do so. Result: UDT1 is now a user exit, but it’s our main date conversion program, with thousands of calls to it!

33 Single Source at KLM Single Source Updates Some statistics for application software: SourcesUpdated Assembler105005% Macro's23000% C(++) % H350095% Linked assembler42100%

34 Single Source at KLM Single Source Updates Next steps: Mass recompile with GCC compiler and Linux HLASM Solve the errors coming from previous step (zero I hope) Load onto a z/TPF test-system and see what happens

35 Single Source at KLM Questions?