Posted: Mon Aug 14, 2006 9:24 pm Post subject: Assembler routine for dynamic allocation - No BPXWDYN
Hi All
I'm looking for an assembler routine which can be called from a COBOL program for dynamic file allocation. I know BPXWDYN or PUTENV can be used for this purpose. But my requirements are
1. Allocate an input file, which can be FB, FBA,VB etc. with different LRECL
2. Allocate a new output file same as input.
3. Read the input file and based on some process write to Output. The
processing can be done in the calling COBOL program.
So the assembler program will allocate two files one in SHR mode and the other in NEW.Also I would like to know whether the assembler routine can handle VSAM KSDS.
Can somebody please help me. _________________ Regds,
Somu
Joined: 03 Jan 2003 Posts: 1014 Topics: 13 Location: Atlantis
Posted: Tue Aug 15, 2006 2:01 am Post subject:
You'll need to write the assembler to modify the parameter lists as you need, but a basic example of SVC99 is:
Code:
SVCTEST CSECT , Simplified SVC 99 invocation
SVCTEST AMODE 31 Generated to duplicate SVC
SVCTEST RMODE 24 call made by ISPF
BAKR 14,0 02:57 - 08/15/06
LR 12,15 Run this with TSO PROFILE WTP
USING SVCTEST,12 -----------------------------------
LA 1,S99RBPTR Get addr of parm list
LR 2,1 Save R1 for TSO TEST
SVC 99 Call Dynalloc
L 0,S99ERROR Save error code
NOPR 0 Place for TSO test breakpoint
PR , Return to caller
S99RBPTR DC A(X'80000000'+S99RB) Address of request block
S99RB DC AL1(20),AL1(1),XL2'6400' Allocate,Flags
S99ERROR DC AL2(0) Returned error code
S99INFO DC AL2(0) Returned info code
S99TXTPP DC A(TULIST,EXTBLOCK,0) Pointer to text units
TU0001 DC X'0001',AL2(1),AL2(8),CL8'ISP02561' DDNAME
TU0002 DC X'0002',AL2(1),AL2(44),CL44'USER1.PRIVATE.COBOL' DSname
TU0003 DC X'0004',AL2(1),AL2(1),X'08' Status SHR
TU0004 DC X'0005',AL2(1),AL2(1),X'08' Norm disp KEEP
TU0005 DC X'0006',AL2(1),AL2(1),X'08' Cond disp KEEP
TU0006 DC X'0010',AL2(1),AL2(6),CL6'CPDLB1' Volser
TU0007 DC X'0015',AL2(1),AL2(8),CL8'3390' Unit
TU0008 DC X'0052',AL2(0) Perm
TU0009 DC X'0056',AL2(1),AL2(44),CL44' ' Ret DSN
TU0010 DC X'0057',AL2(1),AL2(2),X'0000' Ret DSORG
TU0011 DC X'005D',AL2(1),AL2(6),CL6' ' Ret volsr
TULIST DC A(TU0001,TU0002,TU0003,TU0004,TU0005,TU0006,TU0007,TU0008)
DC A(TU0009,TU0010,TU0011+X'80000000')
EXTBLOCK DC CL6'S99RBX',X'01',X'C4',XL200'00' Ext. block.
END SVCTEST
Thanks semigeezer. I have very little knowledge in Assembler. The reason I have asked for an Assembler routine is, I know it's the best option for dynamic file allocation compared to BPXWDYN. Since it does not have any bottleneck like FB, VB and the LRECL.
How do we make it to accept the file name and the other parameter dynamically?.I'm sorry to bother you with the basic questions. _________________ Regds,
Somu
Joined: 03 Jan 2003 Posts: 1014 Topics: 13 Location: Atlantis
Posted: Tue Aug 15, 2006 7:59 am Post subject:
Hi Somuk. Like ssd said, BPXWDYN is a direct interface to the same dynamic allocation as I've shown in the assembler. The results are a little bit harder to diagnose sometimes because return codes are a little harder to follow, but it is really the same thing. I would suggest using BPXWDYN if you can because then you don't need to manipulate these error prone data structures.
Hi semigeezer,
I have checked for BPXWDYN before looking for an assembler option. But the problem is I need to have a properly defined FD section in my COBOL program. Like the one discussed here.
http://www.mvsforums.com/helpboards/viewtopic.php?t=4572&highlight=string+pointer
But I want to handle any type of VB and FB files with any lengths. That was the reason I specifically opted for an assembler routine. _________________ Regds,
Somu
Joined: 03 Dec 2002 Posts: 579 Topics: 1 Location: Iowa, USA
Posted: Tue Aug 15, 2006 9:41 am Post subject:
Even with dynamic allocation you must still have an FD section. Dynamic allocation only handles the allocation, connecting the file to your FD. It is handy when the DSNAME and related info is changeable.
For handling various record formats, you'll need to modify the DCB structure that underlies the FD. I'm not sure if this has ever been discussed in this forum but there is probably a way to address the FD and move in new format values.
I've done this in Assembler, but not COBOL. _________________ Regards,
Bill Dennis
Disclaimer: My comments on this foorum are my own and do not represent the opinions or suggestions of any other person or business entity.
Bill
I'm looking for an assembler routine that can be called from a COBOL program. I checked in Cbttape and found a couple of them but did not get the proper information like how do we call it from a sample COBOL program etc.. _________________ Regds,
Somu
Joined: 24 Oct 2005 Posts: 109 Topics: 36 Location: India
Posted: Wed Jul 11, 2007 5:07 am Post subject:
Somu,
I think allocation and file open close is a different thing. i guess you are confused with macro DYNALLOC and DCB.
Allocation does not bother about the DCB structure as Billy Dennis said.
The FD entries in COBOL i think will be used when the data set actually opens. _________________ I did not fail; I have found 10,000 ways that would not work - Albert Einstein.
You cannot post new topics in this forum You cannot reply to topics in this forum You cannot edit your posts in this forum You cannot delete your posts in this forum You cannot vote in polls in this forum