Page 1 of 2

SHOWCB and register 13 (VSAM)

PostPosted: Mon Nov 21, 2011 11:42 pm
by michel123
Hello,

IBM said in the Appendix H (Summary of register usage) indicate the need to address an ​​18-word save area before running macros: OPEN, CLOSE, GENCB, MODCB, SHOWCB and TESTCB.
Is it an additional zone and different from the usual savearea found at the top of the program for the transition between programs?
Is it save a second area?

Re: SHOWCB and register 13 (VSAM)

PostPosted: Tue Nov 22, 2011 2:50 am
by BillW
It should be a standard save area that you chained up when your program was entered. Anytime you call a routine or some system services, the save area you provide is where your register contents are saved and restored from when control is passed back to your program. So, just guessing without looking, you provide the save area when your program is entered and you will be fine.

Ho this helps.

Re: SHOWCB and register 13 (VSAM)

PostPosted: Tue Nov 22, 2011 6:05 am
by steve-myers
BillW wrote:... Anytime you call a routine or some system services, the save area you provide is where your register contents are saved and restored from when control is passed back to your program. ...
Not quite. IBM macros that call an SVC usually (I can't think of any exceptions) do not require a program provided register save area. LINK and XCTL are exceptions, because the new program they invoke requires a register save area. I/O macros (GET, PUT, READ, WRITE, CHECK, SHOWCB, MODCB, ...) usually require a register save area.

Re: SHOWCB and register 13 (VSAM)

PostPosted: Tue Nov 22, 2011 6:18 pm
by michel123
Hello,

I spent a SHOWCB without manipulating the register 13. Me and the macro returns a good return code. What is really SHOWCB?

Re: SHOWCB and register 13 (VSAM)

PostPosted: Tue Nov 22, 2011 11:04 pm
by BillW
If you are asking what is the showcb is used for, then it is for the following. It is used to extract various fields from the control block in question. Perhaps, you wanted to find out the record length from the file, you would use the showcb to find this out. Or perhaps you wanted to find out the dataset name (after the ACB is open), you could use it for that purpose also. In other words, you can information from the control blocks that you could use to determine what processing you will do based on that information, or perhaps, to display on the console or generate a report with this information. If you don't know what you want to do, then you really don't need to use the showcb macro.

Re: SHOWCB and register 13 (VSAM)

PostPosted: Wed Nov 23, 2011 4:44 pm
by michel123
I expressed myself badly. I meant: The macro SHOWCB generates a call to a module. This module uses a save area, so the iregister 13 at the input.

Should we store in the register 13 with the address of the save area systematically?

Re: SHOWCB and register 13 (VSAM)

PostPosted: Thu Nov 24, 2011 1:28 am
by dick scherrer
Hello,

Anytime you write assembler, you neet to follow "standard linkage" conventions.

Entering your code you need to save the "caller's registers" into your save area and when exiting, you need to restore them.

Every place that i has worked that permits assembler coding, has their own standard - might be Macros might not, but it is always the same.

You should use whatever is the standard for the system you are using.

Re: SHOWCB and register 13 (VSAM)

PostPosted: Thu Nov 24, 2011 1:43 am
by michel123
Okay, I will look and work more the question. I think I have some shortcomings.

Thank you.

Re: SHOWCB and register 13 (VSAM)

PostPosted: Thu Nov 24, 2011 1:49 am
by dick scherrer
Hello,

I think I have some shortcomings.
Not to worry - once upon a time, we all did :)

It takes years - not weeks - to become proficient.

d

Re: SHOWCB and register 13 (VSAM)

PostPosted: Thu Nov 24, 2011 7:26 pm
by BillW
Strictly speaking, when your program is entered, the register contents are stored in the callers save area pointed to by r13. You then chain your save area up (your save area may be static or dynamic), but the point here is that you do not save the contents of the callers registers in your save area. When you make a call to another routine, that routine stores the contents of the registers into your save area, then chains up his save area. To prove this to yourself, think about the conditions at entry. The first thing ones does is to stm r14,r12,12(r13) to save the callers register values into his area (granted, the initial caller smartly got this for you to isolate himself from any nefarious manipulation of the reg contents, so instead what happens when you call someone and that program calls someone further. You save your callers reg contents.