Still celebrating National IT Professionals Day with 3 months of free Premium Membership. Use Code ITDAY17

x
?
Solved

How can I get my SYSPUNCH cards into a single file while unloading from DB2 Table?

Posted on 2013-01-22
15
Medium Priority
?
1,429 Views
Last Modified: 2013-03-05
Hello again Gurus,

I was wondering if anyone has a solution for this issue that I want to resolve. Using LISTDEF and the TEMPLATE command I can dynamically write out all dataset including SYSPUNCH with unique names. However, what if I want to write all SYSPUNCH cards into a single file instead of many files? Something tells me it could be done but I just can't think of how to make that happen.

Can anyone suggest a possible solution?

As always, thank you guys...
0
Comment
Question by:Enyinnaya
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
  • 7
  • 5
  • 3
15 Comments
 
LVL 37

Assisted Solution

by:momi_sabag
momi_sabag earned 501 total points
ID: 38807862
how about using the same filename in the template for syspunch and have disp set to old?
or just don't use a template for syspunch and allocate it in the jcl using a dd card
0
 
LVL 57

Assisted Solution

by:giltjr
giltjr earned 999 total points
ID: 38809861
You might have to make the DISP MOD instead of OLD.  It depends on if DB2 opens/closes the file multiple times or if it is smart enough to just open it once.
0
 

Author Comment

by:Enyinnaya
ID: 38810220
momi_sabag, and giltjr, I tried that already - both DISP=OLD and MOD and got this error:  

DSNU1222I   DSNUULND - TEMPLATE PUNCHDS SPECIFIED FOR PUNCHDDN IS INVALID FOR MUMULTIPLE TABLE SPACES
DSNU012I    DSNUGBAC - UTILITY EXECUTION TERMINATED, HIGHEST RETURN CODE=8



And the TEMPLATE is defined as follows:

 //TEMPDD   DD *
 TEMPLATE UNLOADDS
          DSN('OG3.F&SSID..OSCR.D1UNL.&TS..D&DATE(3)..DATA')
          UNIT SYSDA
          DISP(NEW,CATLG,DELETE)
          EXPDL '1999000'
 TEMPLATE PUNCHDS
          DSN('SD1.F&SSID..OSCR.D1UNL.PUNCH')
          UNIT SYSDA
          DISP(MOD,CATLG,DELETE)
          SPACE (1,1) TRK
 //SYSIN DD *
 OPTIONS LISTDEFDD(LISTDD) TEMPLATEDD(TEMPDD)
 QUIESCE LIST SD1LIST
 UNLOAD  LIST SD1LIST
         UNLDDN   UNLOADDS
         PUNCHDDN PUNCHDS

If ony I can use LISTDEF with IEBGENER, I could then append all SYSPUNCH dataset to to one SYSUT2 output dataset.

Anyone have anyother ideas?

Thanks
0
How Blockchain Is Impacting Every Industry

Blockchain expert Alex Tapscott talks to Acronis VP Frank Jablonski about this revolutionary technology and how it's making inroads into other industries and facets of everyday life.

 
LVL 57

Expert Comment

by:giltjr
ID: 38810281
If I understand the DB2 manuals correctly the only initial DISP you can have for punch is new.

It looks like you would need to use another step to copy each individual file into a single file.  If you use a GDG for this you could then use IEBGENER to copy all generations into a single file.
0
 

Author Comment

by:Enyinnaya
ID: 38814968
giltjr,

Okay, how would you use GDG and IEBGENER to accomplish your suggestion. The tablespace name is variable and many. IEBGENER GDG(0) for every tablespace each time I run the UNLOAD?
0
 
LVL 37

Expert Comment

by:momi_sabag
ID: 38815162
don't go through all that trouble

what happens if you allocate syspunch in the jcl?

//SYSPUNCH DD DISP=...
0
 
LVL 57

Assisted Solution

by:giltjr
giltjr earned 999 total points
ID: 38815414
Remove the table space name from the GDG name so that all table spaces are part of the game GDG.

Make sure the GDG is empty when you start.

Then SYSUT1 would refer to the base GDG name only.  When you refer to the base GDG name, it will read ALL generations.
0
 

Author Comment

by:Enyinnaya
ID: 38833882
momi_sabq,

You suggestion is what we currrently doing. What we are trying to achieve is to avoid having to go intoeach and every unload/Load job to add or remove a new tablespace or delete a dropped tablespace.
0
 

Author Comment

by:Enyinnaya
ID: 38833891
giltjr,

I don't understand what you are telling me. If I could, I would like to write all the tablespace SYSPUNCH cards to only one file or find a clever way to get my JCL to copy each and all punch cards dataset into one file. Your suggestion intriques me and I plan to try that method on Wednesday.
However, can you explain further what you would do to set up the GDG structure? Please some examples will be much helpful. I learn better with examples.

Thank you
0
 

Author Comment

by:Enyinnaya
ID: 38833991
gilrjr,

I have tried the GDG suggestion and I got thhis error:
Here's my Template definition for the GDGs:
TEMPLATE UNLOADDS
         DSN('GO1.F&DB(5,4)..OSCR.D1UNL.&TS..DATA')
         UNIT SYSDA
         DISP(NEW,CATLG,DELETE)
         EXPDL '1999000'
TEMPLATE PUNCHDS
         DSN('GO1.F&DB(5,4)..OSCR.D1UNL.LODPUNCH')
         UNIT SYSDA
         DISP(NEW,CATLG,DELETE)
         SPACE (1,1) TRK
         GDGLIMIT(3)




DSNUQUIB - QUIESCE UTILITY COMPLETE, ELAPSED TIME= 00:00:00
DSNUGUTC -  UNLOAD LIST OG1LIST UNLDDN UNLOADDS PUNCHDDN PUNCHDS
DSNUGULM - PROCESSING LIST ITEM: TABLESPACE OG1DDEV1.OG1SCAM1
DSNUGTIS - PROCESSING TEMPDD AS EBCDIC
DSNUULND - TEMPLATE PUNCHDS SPECIFIED FOR PUNCHDDN IS INVALID FOR MULTIPLE TABLE
DSNUGBAC - UTILITY EXECUTION TERMINATED, HIGHEST RETURN CODE=8


If the Template GDG cannot be used, can you show example of how I could use the IEBGENER method.

Thank you
0
 
LVL 37

Assisted Solution

by:momi_sabag
momi_sabag earned 501 total points
ID: 38834129
try something like
 DSN('GO1.F&DB(5,4).&TS(5,4)..OSCR.D1UNL.LODPUNCH')

so that each tablespace will get a different file
0
 
LVL 57

Assisted Solution

by:giltjr
giltjr earned 999 total points
ID: 38835622
Your template name for the GDG is wrong, it should be:

   DSN('GO1.F&DB(5,4)..OSCR.D1UNL.LODPUNCH(+1)')

Notice the(+1) on the end.  This will create a unique generation for each table space, but using a common GDG base name.  Then you can use then you can use IEBGENER:

//S01OF99 EXEC PGM=IEBGENER
//SYSPRINT DD SYSOUT=*
//SYSIN DD DUMMY
//SYSUT1 DD DSN=GO1.Fxxxx..OSCR.D1UNL.LODPUNCH,DISP=OLD
//SYSUT2 DD DSN=SOMENAME.DISP=(,CATLG)

Where xxxx is the 4 positions from &DB(5,4).  Then once you are done, you can delete all of the generations, so that next time you start from scratch.
0
 

Author Comment

by:Enyinnaya
ID: 38837792
moni_sabq, giltjr,  Let me clarify what I am trying to accomplish.
Everything you guys gave suggested on tis thread works...I can create a SYSPUNCH dataset using the template whether it is a GDG based dataset or a simple sequential file. I can dynamically create a file (lets call it FILEA) containing all the SYSPUNCH file names that I generated from doing an UNLOAD. THe whole idea is not to have to hard code tablespace name each and everytime a tablespace is added or dropped. I simply read my SYSTABLESPACE, extract the tablespace I am after, build according to the SYSPUNCH naming convention used during UNLOAD, feed this FILEA to SYSUT1 such as the following:

//S01OF99 EXEC PGM=IEBGENER
//SYSPRINT DD SYSOUT=*
//SYSIN DD DUMMY
//SYSUT1 DD DSN=FILEA,DISP=OLD
//SYSUT2 DD DSN=SOMENAME,DISP=(,CATLG)

I want IEBGENER to read FILEA and copy the actual SYSPUNCH contoll statements of each name registered in FILEA to to 1 single file named in SYSUT2. Inorder words merge all files. The contents of FILEA is just a list of files to copy into SYSUT2 and the structure will look like this:

FILEA:
DD DISP=SHR,DSN=GO1.FDEV1.OSCR.D1UNL.GO1SCAM1.PUNCH
DD DISP=SHR,DSN=GO1.FDEV1.OSCR.D1UNL.GO1SCJR1.PUNCH
DD DISP=SHR,DSN=GO1.FDEV1.OSCR.D1UNL.GO1SDNF1.PUNCH
DD DISP=SHR,DSN=GO1.FDEV1.OSCR.D1UNL.GO1SGAJ1.PUNCH
DD DISP=SHR,DSN=GO1.FDEV1.OSCR.D1UNL.GO1SGCT1.PUNCH
DD DISP=SHR,DSN=GO1.FDEV1.OSCR.D1UNL.GO1SMSR1.PUNCH
DD DISP=SHR,DSN=GO1.FDEV1.OSCR.D1UNL.GO1SNAK1.PUNCH
DD DISP=SHR,DSN=GO1.FDEV1.OSCR.D1UNL.GO1SOFC1.PUNCH
DD DISP=SHR,DSN=GO1.FDEV1.OSCR.D1UNL.GO1SGO11.PUNCH

When I tried this method, IEBGENER errors-out with this message:

DATA SET UTILITY - GENERATE
      DD DISP=SHR,DSN=GO1.FDEV1.OSCR.D1UNL.GO1SCAM1.PUNCH
IEB336I       INVALID COMMAND IN COL. 07
      DD DISP=SHR,DSN=GO1.FDEV1.OSCR.D1UNL.GO1SCJR1.PUNCH
IEB336I       INVALID COMMAND IN COL. 07
      DD DISP=SHR,DSN=GO1.FDEV1.OSCR.D1UNL.GO1SDNF1.PUNCH
IEB336I       INVALID COMMAND IN COL. 07
      DD DISP=SHR,DSN=GO1.FDEV1.OSCR.D1UNL.GO1SGAJ1.PUNCH

What do I need to correct the error and make this work.

Thanks
0
 
LVL 57

Accepted Solution

by:
giltjr earned 999 total points
ID: 38837907
IEBGENGER does not work that way.  IEBGENER copies the file(s) defined by the DD statement SYSUT1 to the file defined by SYSUT2.  

You might be able to use IDCAMS

You could use
//OUTDD DD DISP=(MOD,DELETE),DSN=SOMEFILENAME
//SYSIN DD DISP=OLD,DSN=INPUT

Where DSN=INPUT contains statements like:

REPRO OFILE(OUTDD) IDS(GO1.FDEV1.OSCR.D1UNL.GO1SCAM1.PUNCH)
REPRO OFILE(OUTDD) IDS(GO1.FDEV1.OSCR.D1UNL.GO1SCJR1.PUNCH)
0
 

Author Closing Comment

by:Enyinnaya
ID: 38953709
ok
0

Featured Post

Ransomware: The New Cyber Threat & How to Stop It

This infographic explains ransomware, type of malware that blocks access to your files or your systems and holds them hostage until a ransom is paid. It also examines the different types of ransomware and explains what you can do to thwart this sinister online threat.  

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Create your own, high-performance VM backup appliance by installing NAKIVO Backup & Replication directly onto a Synology NAS!
Your data is at risk. Probably more today that at any other time in history. There are simply more people with more access to the Web with bad intentions.
This tutorial will walk an individual through the steps necessary to enable the VMware\Hyper-V licensed feature of Backup Exec 2012. In addition, how to add a VMware server and configure a backup job. The first step is to acquire the necessary licen…
To efficiently enable the rotation of USB drives for backups, storage pools need to be created. This way no matter which USB drive is installed, the backups will successfully write without any administrative intervention. Multiple USB devices need t…

715 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question