View previous topic :: View next topic
|
Author |
Message |
puspendrakarasi
New User
Joined: 09 Apr 2007 Posts: 1 Location: India
|
|
|
|
Hi guys,
My problem is that, I have a big sequential file containing records of thusands of customer. I want to write records belongs to a perticular customer in seperate file. In JCL i am giving the name of output file for every customer. But i don't waana write SELECT statement and FD entry for every output file. Please suggest me how i can do this. |
|
Back to top |
|
|
dick scherrer
Moderator Emeritus
Joined: 23 Nov 2006 Posts: 19244 Location: Inside the Matrix
|
|
|
|
Hello,
Copy your sequential file into a keyed vsam file. I'd make the primary key an arbitrary, generated sequential number and create an alternate index for the customer number that allows duplicates.
Write a program that accepts a customer number as input (via a PARM/symbolic parameter), reads the vsam records for that customer, and writes them to an output file. The program will only have 1 output file, not "thousands".
Create a small PROC that uses symbolic parameters to create unique dataset names for each output file. You can execute the PROC many times in the same job, until you have created all of the customer specific files.
After all of the needed files have been created, delete the vsam file.
Is this going to be COBOL? If so, let me know and i'll move this to the COBOL forum. |
|
Back to top |
|
|
Bitneuker
CICS Moderator
Joined: 07 Nov 2005 Posts: 1104 Location: The Netherlands at Hole 19
|
|
|
|
PL/1 and TITLE an option? |
|
Back to top |
|
|
ricky.airi04
New User
Joined: 25 May 2007 Posts: 1 Location: India
|
|
|
|
Hi dick this is a question related to COBOL. Thanks 4 ur valuable suggestion. Is there any way to change the DDNAME used in SELECT clause as per Customer code. I heard that we can do this by assembler. But i don't know how? |
|
Back to top |
|
|
expat
Global Moderator
Joined: 14 Mar 2007 Posts: 8797 Location: Welsh Wales
|
|
|
|
But don't forget the operating system restrictions on the number of steps / ddnames that you can allocate. |
|
Back to top |
|
|
dick scherrer
Moderator Emeritus
Joined: 23 Nov 2006 Posts: 19244 Location: Inside the Matrix
|
|
|
|
You're welcome
If you set this up using the previous suggestion, you wouldn't need to change the DDNAME (you also would need only one select). You would only need to provide the DSN and customer-id as symbolic parameters to the proc that would execute for each file that you wanted to create. |
|
Back to top |
|
|
Raphael Bacay
New User
Joined: 04 May 2007 Posts: 58 Location: Manila, Philippines
|
|
|
|
Hi!
I would like to suggest using COBOL-CICS online submitted to create a job in CICS. Then use GDG for generations (0), (1), (2), etc.
You can loop in the CICS program for the incrementing generation
and do a submit of a job everytime. This way you can endlessly submit jobs until all customers have been processed.
The customer file can be sorted first for processing. Then
in your COBOL-CICS program you can process one customer
at a time and use GDG for a different output file each time.
Please research on online submitted jobs and GDGs.
It might work... |
|
Back to top |
|
|
agkshirsagar
Active Member
Joined: 27 Feb 2007 Posts: 691 Location: Earth
|
|
|
|
What I have understood from OPs question is that he wants to change DDname according to some paramerer in program. I just know that, it can be done by changes in DCB.
Maybe experts here know more about DCB.. |
|
Back to top |
|
|
dick scherrer
Moderator Emeritus
Joined: 23 Nov 2006 Posts: 19244 Location: Inside the Matrix
|
|
|
|
Hello,
I can see why different dsn's might be created, but still do not understand why different ddnames are wanted (i don't believe they are needed) Regardless of the approach used, "thousands" of files cannot be created in one step. |
|
Back to top |
|
|
agkshirsagar
Active Member
Joined: 27 Feb 2007 Posts: 691 Location: Earth
|
|
|
|
Forget about "thousands", OP wants to write in different DSNs with different DDnames, but he wants to use only one select clause.
I just wrote that it is possible, HOW? I can't tell that, but I am using one such system here. |
|
Back to top |
|
|
dick scherrer
Moderator Emeritus
Joined: 23 Nov 2006 Posts: 19244 Location: Inside the Matrix
|
|
|
|
Hello,
If OP wants to forget about
Quote: |
thusands of customer. I want to write records belongs to a perticular customer in seperate file |
that is ok by me, but if the requirement is still to write many of these customer specific files, i am still not convinced that there is a need to dynamically create a series of ddnames. Keep in mind that in addition to getting the task running successfully, it will also need to be maintained by someone other than the author. . .
Quote: |
I just wrote that it is possible, HOW? |
has been done using assembler where i've seen it done. You might look at the code for the process you are using to see how "they" did it. |
|
Back to top |
|
|
agkshirsagar
Active Member
Joined: 27 Feb 2007 Posts: 691 Location: Earth
|
|
|
|
Dick,
I must say that Assembler is pretty hard for me to understand. I will keep trying though.. |
|
Back to top |
|
|
anv2005
New User
Joined: 14 Jul 2005 Posts: 44 Location: US
|
|
|
|
Dick,
I do agree.
The best way to solve the problem is to implement a generic I/O driver in assembler.
The assembler program would dynamically allocate a required DD name, and will handle all I/O requests against this dynamically allocated file, including the OPEN, CLOSE, READ and WRITE statements.
Once processing is completed against a single account, i.e. customer, this assembler program would free the DD name.
The COBOL programs would simply call this assembler program for all its I/O requests.
Some of our customers do exactly this.
Regards,
Alex. |
|
Back to top |
|
|
Itanium
Active User
Joined: 22 Jan 2006 Posts: 114 Location: India
|
|
|
|
Hi puspendrakarasi,
This can be done be dynamically allocating the file in COBOL Program. This doesn't require 'n' number of FD's coded in your program and DD's coded in your JCL.
You don't have to implement a generic I/O assembler for this, there is already one from IBM for this, the module is bpxwdyn
Find below the documentation of that module.
ftp://ftp.software.ibm.com/s390/zos/tools/bpxwdyn/bpxwdyn.unload
Hope this infn is useful.
Thanks,
Itanium |
|
Back to top |
|
|
dick scherrer
Moderator Emeritus
Joined: 23 Nov 2006 Posts: 19244 Location: Inside the Matrix
|
|
|
|
Hello,
Have you successfully used bpxwdyn in a cobol situation?
Keep in mind that the original question was about using dynamic ddnames from a cobol program. While you may call this and accomplish allocation and de-allocation, how will the calling cobol program issue open/close - read/write to the dynamically allocated file?
If you can post a working cobol example, several people will find an answer to similar questions.
Also, keep in mind many places will not permit downloading a module to replace something that already exists in SYS1.LINKLIB. |
|
Back to top |
|
|
|