Download presentation
Presentation is loading. Please wait.
Published byNathaniel Booth Modified over 9 years ago
1
Application Development Single Source Updates at KLM and tools used The Highlights Michael Bahlen TPF user group Dallas - 15 April 2008
2
2 Single Source at KLM Single Source Updates Excitement! z/TPF Applying Single Source So many times the same thing!
3
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
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
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
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
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
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
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 @@TRT STRUPR TMSPC LWS=R4 LR R3,R1 COPY INPUT POINTER L R1,PSTR GET POINTER TO STRING LR R6,R1 COPY FOR LATER L R2,=A(@@TRT) 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
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
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
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
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
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
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
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
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. http://www2.hursley.ibm.com/decimal/decnumber.pdf
18
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
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
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
21 Single Source at KLM Main display of IdefixGui with Demo Grip (collection of sources)
22
22 Single Source at KLM Select Single Source check for Complete Grip
23
23 Single Source at KLM GUI shows progress
24
24 Single Source at KLM Results are written to event file and shown through an event viewer
25
25 Single Source at KLM After double click Editor opens on place to change
26
26 Single Source at KLM For scanning sources that need Single Source, a special path search is included.
27
27 Single Source at KLM Result is also passed to the event viewer
28
28 Single Source at KLM For generating assembler prototype, a special function is created to generate the assembler file containing the CPROC statements
29
29 Single Source at KLM Assembler file before creation of CPROC statements
30
30 Single Source at KLM Assembler file after creation of CPROC statements
31
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
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
33 Single Source at KLM Single Source Updates Some statistics for application software: SourcesUpdated Assembler105005% Macro's23000% C(++)5200100% H350095% Linked assembler42100%
34
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
35 Single Source at KLM Questions? michael.bahlen@klm.com
Similar presentations
© 2025 SlidePlayer.com. Inc.
All rights reserved.