Portal | Manuals | References | Downloads | Info | Programs | JCLs | Master the Mainframes
IBM Mainframe Computers Forums Index
 
Register
 
IBM Mainframe Computers Forums Index Mainframe: Search IBM Mainframe Forum: FAQ Memberlist Usergroups Profile Log in to check your private messages Log in
 

 

Call IDCAMS in Cobol

 
Post new topic   Reply to topic    IBMMAINFRAMES.com Support Forums -> COBOL Programming
View previous topic :: :: View next topic  
Author Message
rochej3

New User


Joined: 02 Aug 2005
Posts: 4

PostPosted: Tue Aug 02, 2005 8:47 pm    Post subject: Call IDCAMS in Cobol
Reply with quote

Hello,

I want to call IDCAMS in my Cobol program. Using the LISTCAT command in IDCAMS, I want to retrieve the number of records in a certain file that the program is reading. I want to pass this number back to my Cobol program. How can I go about this?

Any information will be very much appreciated.

Thanks!
Back to top
View user's profile Send private message

die7nadal

Active User


Joined: 23 Mar 2005
Posts: 156

PostPosted: Wed Aug 03, 2005 12:37 am    Post subject:
Reply with quote

If I understood u correctly, I dont think u can use the LISTCAT command to get the number of records in a file. U can count the number of records using a simple cobol code, by incrementing a counter every time u read a record but if you want the count from a JCL find here http://ibmmainframes.com/viewtopic.php?t=2235&highlight=record+count
Back to top
View user's profile Send private message
die7nadal

Active User


Joined: 23 Mar 2005
Posts: 156

PostPosted: Wed Aug 03, 2005 12:42 am    Post subject:
Reply with quote

Any way here is a piece of code through which you can invoke IDCAMS from COBOL, http://www.naspa.com/PDF/2000/0100%20TS%20PDFs/T0001006.pdf
Back to top
View user's profile Send private message
rochej3

New User


Joined: 02 Aug 2005
Posts: 4

PostPosted: Wed Aug 03, 2005 2:10 am    Post subject: Call IDCAMS in Cobol
Reply with quote

Thanks for your prompt reply.

I was wrong when I said number of records. What I meant was number of record bytes actually used by the file. I want to use the number to allocate another file eliminating the freespace the 1st file has. Is there a way to do this?
Back to top
View user's profile Send private message
die7nadal

Active User


Joined: 23 Mar 2005
Posts: 156

PostPosted: Wed Aug 03, 2005 2:41 am    Post subject:
Reply with quote

By counting the number of records and by knowing the LRECL,BLKSIZE of the file the space can be allocated in BLKS for the dataset. Suppose the LRECL is 10 and the BLKSIZE is 50 then for storing 100 Records u shud allocate 20 BLOCKS
Code:

No. of Blocks = No. of Records * LRECL / BLKSIZE
 
SPACE=(50,20,RLSE)
Back to top
View user's profile Send private message
die7nadal

Active User


Joined: 23 Mar 2005
Posts: 156

PostPosted: Wed Aug 03, 2005 3:15 am    Post subject:
Reply with quote

U can also allocate the space based on the No. of records(100) & LRECL (10) only as follows for the above example
Code:
SPACE=(10,100,RLSE),AVGREC=U
Back to top
View user's profile Send private message
rochej3

New User


Joined: 02 Aug 2005
Posts: 4

PostPosted: Wed Aug 03, 2005 3:34 am    Post subject:
Reply with quote

Thanks again!

I think it's better if I give you the logic I'm creating. My program is currently reading file1 and backing up all the contents into file2. File1 has a lot of freespace. What I want to do is get the actual space used by file1 and then use that number to allocate file2. Then, i will delete file1.

Can you recommend anything?

Thanks! :^)
Back to top
View user's profile Send private message
die7nadal

Active User


Joined: 23 Mar 2005
Posts: 156

PostPosted: Wed Aug 03, 2005 3:59 am    Post subject:
Reply with quote

rochej3,

Do u want to know how to find the no. of recs in the file ???
U can find the records by using a variety of ways, I wud write a cobol code to do that. Do u need the code??

The actual space occupied by the file1 can be calculated only if u know the no. of records.

U have to find the No. of records to allocate the space more precisely, it can also be done less acurately by allocating a maximum no of cylinders as

SPACE=(CYL,(100,20),RLSE)

and the RLSE parm wud free all the cylinders that are not used when it closes the file.
Back to top
View user's profile Send private message
rochej3

New User


Joined: 02 Aug 2005
Posts: 4

PostPosted: Wed Aug 03, 2005 10:41 pm    Post subject:
Reply with quote

Thanks for that information.

Can I use the RLSE parameter in this logic?
DEFINE CLUSTER (NAME(filename.test1) -
MODEL(filename.test) -
CYLINDERS(25 25 ) )
Back to top
View user's profile Send private message
die7nadal

Active User


Joined: 23 Mar 2005
Posts: 156

PostPosted: Wed Aug 03, 2005 11:13 pm    Post subject:
Reply with quote

Yes, u can Release the unused but allocated Space from a VSAM Dasaset using the ALLOCATE Command of IDCAMS, for syntax follow this link
http://publibfp.boulder.ibm.com/cgi-bin/bookmgr/FRAMESET/DGT2I230/CCONTENTS?DT=20040628101835
Back to top
View user's profile Send private message
View previous topic :: :: View next topic  
Post new topic   Reply to topic    IBMMAINFRAMES.com Support Forums -> COBOL Programming All times are GMT + 6 Hours
Page 1 of 1

 

Search our Forum:

Similar Topics
Topic Author Forum Replies Posted
This topic is locked: you cannot edit posts or make replies. Cobol GUI (like Editor) Kala Mainframe COBOL Programming 14 Wed May 10, 2017 12:30 pm
No new posts IMS T-Pipe queue counts in a COBOL Pr... Siva NKK Kothamasu IMS DB/DC 0 Tue May 09, 2017 6:31 pm
No new posts COBOL Code Parsers and Lineage Establ... balimanja COBOL Programming 2 Tue May 02, 2017 3:30 am
No new posts Cobol upgrade - source code missing f... gthmrj IBM Tools 1 Wed Apr 26, 2017 6:04 pm
No new posts Need help in REXX CALL program Raje1002 CLIST & REXX 5 Wed Apr 19, 2017 11:18 pm


Facebook
Back to Top
 
Mainframe Wiki | Forum Rules | Bookmarks | Subscriptions | FAQ | Tutorials | Contact Us