IBM Mainframe Forum Index
 
Log In
 
IBM Mainframe Forum Index Mainframe: Search IBM Mainframe Forum: FAQ Register
 

How to write in thousands of file according to records?


IBM Mainframe Forums -> COBOL Programming
Post new topic   Reply to topic
View previous topic :: View next topic  
Author Message
puspendrakarasi

New User


Joined: 09 Apr 2007
Posts: 1
Location: India

PostPosted: Sat May 26, 2007 1:01 pm
Reply with quote

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
View user's profile Send private message
dick scherrer

Moderator Emeritus


Joined: 23 Nov 2006
Posts: 19244
Location: Inside the Matrix

PostPosted: Sat May 26, 2007 2:07 pm
Reply with quote

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
View user's profile Send private message
Bitneuker

CICS Moderator


Joined: 07 Nov 2005
Posts: 1104
Location: The Netherlands at Hole 19

PostPosted: Sat May 26, 2007 11:32 pm
Reply with quote

PL/1 and TITLE an option?
Back to top
View user's profile Send private message
ricky.airi04

New User


Joined: 25 May 2007
Posts: 1
Location: India

PostPosted: Mon May 28, 2007 5:34 pm
Reply with quote

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
View user's profile Send private message
expat

Global Moderator


Joined: 14 Mar 2007
Posts: 8797
Location: Welsh Wales

PostPosted: Mon May 28, 2007 6:20 pm
Reply with quote

But don't forget the operating system restrictions on the number of steps / ddnames that you can allocate.
Back to top
View user's profile Send private message
dick scherrer

Moderator Emeritus


Joined: 23 Nov 2006
Posts: 19244
Location: Inside the Matrix

PostPosted: Mon May 28, 2007 9:19 pm
Reply with quote

You're welcome icon_smile.gif

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
View user's profile Send private message
Raphael Bacay

New User


Joined: 04 May 2007
Posts: 58
Location: Manila, Philippines

PostPosted: Wed May 30, 2007 10:34 am
Reply with quote

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
View user's profile Send private message
agkshirsagar

Active Member


Joined: 27 Feb 2007
Posts: 691
Location: Earth

PostPosted: Wed May 30, 2007 5:17 pm
Reply with quote

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
View user's profile Send private message
dick scherrer

Moderator Emeritus


Joined: 23 Nov 2006
Posts: 19244
Location: Inside the Matrix

PostPosted: Wed May 30, 2007 6:18 pm
Reply with quote

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) icon_confused.gif Regardless of the approach used, "thousands" of files cannot be created in one step.
Back to top
View user's profile Send private message
agkshirsagar

Active Member


Joined: 27 Feb 2007
Posts: 691
Location: Earth

PostPosted: Wed May 30, 2007 6:26 pm
Reply with quote

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
View user's profile Send private message
dick scherrer

Moderator Emeritus


Joined: 23 Nov 2006
Posts: 19244
Location: Inside the Matrix

PostPosted: Wed May 30, 2007 7:09 pm
Reply with quote

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
View user's profile Send private message
agkshirsagar

Active Member


Joined: 27 Feb 2007
Posts: 691
Location: Earth

PostPosted: Thu May 31, 2007 12:06 am
Reply with quote

Dick,
I must say that Assembler is pretty hard for me to understand. I will keep trying though.. icon_smile.gif
Back to top
View user's profile Send private message
anv2005

New User


Joined: 14 Jul 2005
Posts: 44
Location: US

PostPosted: Thu May 31, 2007 12:29 am
Reply with quote

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
View user's profile Send private message
Itanium

Active User


Joined: 22 Jan 2006
Posts: 114
Location: India

PostPosted: Sun Jun 03, 2007 4:50 am
Reply with quote

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
View user's profile Send private message
dick scherrer

Moderator Emeritus


Joined: 23 Nov 2006
Posts: 19244
Location: Inside the Matrix

PostPosted: Sun Jun 03, 2007 6:11 am
Reply with quote

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
View user's profile Send private message
View previous topic :: :: View next topic  
Post new topic   Reply to topic View Bookmarks
All times are GMT + 6 Hours
Forum Index -> COBOL Programming

 


Similar Topics
Topic Forum Replies
No new posts Compare 2 files(F1 & F2) and writ... JCL & VSAM 8
No new posts FTP VB File from Mainframe retaining ... JCL & VSAM 8
No new posts Extract the file name from another fi... DFSORT/ICETOOL 6
No new posts How to split large record length file... DFSORT/ICETOOL 10
No new posts Extracting Variable decimal numbers f... DFSORT/ICETOOL 17
Search our Forums:

Back to Top