Merging to members into one



JES, JES2, JCL utilities, IDCAMS, Compile & Run JCLs, PROCs etc...

Merging to members into one

Postby fuuss » Wed Mar 19, 2008 4:05 pm

Hello , I am rather new to this forum and need a little help
I have 2 Files
One member is
fuuss.job.cntl (acces)
000001 ZABCDEF               
000002 ABCDEFG               
000003 BCDEFGH               
000004 CDEFGHI               
and so on       

second one is
fuuss.job.cntl(usern)
000001 45551147
000002 12345678
000003 44557884


and I need JCL that merges this 2 Members in a new file (Name doesn't matter)
000001 CMD="PE ZABCDEF CL(GCICSTRN) ID(45551147) ACCESS(READ)";CALL DOIT
000002 CMD="PE ABCDEFG CL(GCICSTRN) ID(45551147) ACCESS(READ)";CALL DOIT
000003 CMD="PE BCDEFGH CL(GCICSTRN) ID(45551147) ACCESS(READ)";CALL DOIT
000004 CMD="PE CDEFGHI CL(GCICSTRN) ID(45551147) ACCESS(READ)";CALL DOIT
000005 CMD="PE ZABCDEF CL(GCICSTRN) ID(12345678) ACCESS(READ)";CALL DOIT
000006 CMD="PE ABCDEFG CL(GCICSTRN) ID(12345678) ACCESS(READ)";CALL DOIT
000007 CMD="PE BCDEFGH CL(GCICSTRN) ID(12345678) ACCESS(READ)";CALL DOIT
000008 CMD="PE CDEFGHI CL(GCICSTRN) ID(12345678) ACCESS(READ)";CALL DOIT
AND SO ON

the other things are fixed so CMD="PE and so on

can somebody help me

thx in advance
fuuss
 
Posts: 40
Joined: Wed Mar 19, 2008 3:53 pm
Has thanked: 0 time
Been thanked: 0 time

Re: Merging to members into one

Postby arunprasad.k » Wed Mar 19, 2008 11:04 pm

If the PDS has only 2 members (and the member names keep changing), then use IEBPTPCH to copy the PDS to PS and then use sort products to do whatever formatting you want.

If the PDS has members other than these 2 (and the member names are constant), you can append both the members in SORTIN DD name as below.

SORTIN  DD  DSN=YOUR.PDS.NAME(MEM1),DISP=SHR
             DD  DSN=YOUR.PDS.NAME(MEM1),DISP=SHR


Also I did not understand how the value '45551147' is getting loaded for records 02 to 04, and '12345678' is loaded for the rest.

Arun.
arunprasad.k
 
Posts: 110
Joined: Thu Dec 27, 2007 5:18 pm
Has thanked: 0 time
Been thanked: 0 time

Re: Merging to members into one

Postby dick scherrer » Thu Mar 20, 2008 12:10 am

Hello,

Also I did not understand how the value '45551147' is getting loaded for records 02 to 04, and '12345678' is loaded for the rest.
1 to 4?

I believe the output needs to be a "cartesian product" of the inputs. The sample output posted is only the first 2 "sets".
Hope this helps,
d.sch.
User avatar
dick scherrer
Global moderator
 
Posts: 6268
Joined: Sat Jun 09, 2007 8:58 am
Has thanked: 3 times
Been thanked: 93 times

Re: Merging to members into one

Postby fuuss » Thu Mar 20, 2008 12:27 pm

Yes Correct the output is only for the 2 first sets

and how about icetool wouldn't that be an option?

(yeah I know in this case wrong topic)
fuuss
 
Posts: 40
Joined: Wed Mar 19, 2008 3:53 pm
Has thanked: 0 time
Been thanked: 0 time

Re: Merging to members into one

Postby fuuss » Thu Mar 20, 2008 12:41 pm

Ok so again output file would be

000001 CMD="PE <data1fromacces> CL(GCICSTRN) ID(data1fromusern) ACCESS(READ)";CALL DOIT
000002 CMD="PE <data2fromacces> CL(GCICSTRN) ID(data1fromusern) ACCESS(READ)";CALL DOIT
000003 CMD="PE <data3fromacces> CL(GCICSTRN) ID(data1fromusern) ACCESS(READ)";CALL DOIT
000004 CMD="PE <data4fromacces> CL(GCICSTRN) ID(data1fromusern) ACCESS(READ)";CALL DOIT

000005 CMD="PE <data1fromacces> CL(GCICSTRN) ID(data2fromusern) ACCESS(READ)";CALL DOIT
000006 CMD="PE <data2fromacces> CL(GCICSTRN) ID(data2fromusern) ACCESS(READ)";CALL DOIT
000007 CMD="PE <data3fromacces> CL(GCICSTRN) ID(data2fromusern) ACCESS(READ)";CALL DOIT
000008 CMD="PE <data4fromacces> CL(GCICSTRN) ID(data2fromusern) ACCESS(READ)";CALL DOIT

000009 CMD="PE <data1fromacces> CL(GCICSTRN) ID(data3fromusern) ACCESS(READ)";CALL DOIT
000010 CMD="PE <data2fromacces> CL(GCICSTRN) ID(data3fromusern) ACCESS(READ)";CALL DOIT
000011 CMD="PE <data3fromacces> CL(GCICSTRN) ID(data3fromusern) ACCESS(READ)";CALL DOIT
000012 CMD="PE <data4fromacces> CL(GCICSTRN) ID(data3fromusern) ACCESS(READ)";CALL DOIT

000013 CMD="PE <data1fromacces> CL(GCICSTRN) ID(data4fromusern) ACCESS(READ)";CALL DOIT
000014 CMD="PE <data2fromacces> CL(GCICSTRN) ID(data4fromusern) ACCESS(READ)";CALL DOIT
000015 CMD="PE <data3fromacces> CL(GCICSTRN) ID(data4fromusern) ACCESS(READ)";CALL DOIT
000016 CMD="PE <data4fromacces> CL(GCICSTRN) ID(data4fromusern) ACCESS(READ)";CALL DOIT
......


I hope it's more clear now ;-)

thx
fuuss
 
Posts: 40
Joined: Wed Mar 19, 2008 3:53 pm
Has thanked: 0 time
Been thanked: 0 time

Re: Merging to members into one

Postby arunprasad.k » Fri Mar 21, 2008 9:36 am

There is some level of programming involved in this. I do not think you could do this with some sort product. May be let's wait for the experts comments.

If i were you i would go with REXX. But this can be done through any application programming.

I assume that the record counts in both the files are not fixed. Do correct me if my assumption is wrong. If the record count in any of the files (say File 2 will have only 4 records) is fixed and a small quantity then this can be done sort products.

Arun.
arunprasad.k
 
Posts: 110
Joined: Thu Dec 27, 2007 5:18 pm
Has thanked: 0 time
Been thanked: 0 time

Re: Merging to members into one

Postby arunprasad.k » Fri Mar 21, 2008 12:20 pm

How about this REXX!! :ugeek:

/* rexx */                                                             
"alloc da('fuuss.job.cntl(acces)')  f(file01) shr reuse"               
"alloc da('fuuss.job.cntl(usern)')  f(file02) shr reuse"               
"alloc da('fuuss.job.cntl(outpt)')  f(file03) mod reuse"               
"execio * diskr file01 (stem record1. finis"                           
"execio * diskr file02 (stem record2. finis"                           
num  = 1000000                                                         
var1 = ' CMD="PE '                                                     
var2 = ' CL(GCICSTRN) ID('                                             
var3 = ') ACCESS(READ)";CALL DOIT'                                     
do i = 1 to record2.0                                                   
   id = substr(record2.i,8,8)                                           
   do j = 1 to record1.0                                               
      access  = substr(record1.j,8,7)                                   
      num     = num + 1           /* I dont know how to retain       */
      nums    = substr(num,2,6)   /* preceeding 0 !!                 */
      record3 = nums||var1||access||var2||id||var3                     
      push record3                                                     
      "execio 1 diskw file03"                                           
   end                                                                 
end   


Fuuss, Edit this REXX to have your original file names and save this REXX in the PDS/Sequential dataset with LRECL=80 and give 'EX' (in the place where you give 'B' to browse the dataset) to run the REXX.

Post if you have any questions.

Arun.
arunprasad.k
 
Posts: 110
Joined: Thu Dec 27, 2007 5:18 pm
Has thanked: 0 time
Been thanked: 0 time

Re: Merging to members into one

Postby fuuss » Fri Mar 21, 2008 1:04 pm

Wow thank you for the quick help

maybe Rex is really an good option I will try it



thank you very much for your help


Fuuss

Ps I let you know if i got it wo work
fuuss
 
Posts: 40
Joined: Wed Mar 19, 2008 3:53 pm
Has thanked: 0 time
Been thanked: 0 time

Re: Merging to members into one

Postby fuuss » Fri Mar 21, 2008 2:49 pm

Ok perfekt I changed a bit but now working perfekt

Just one question , may you explain me the alloc thing , the rest is clear but that one ( as I am as new to Rexx that Jcl) I always want to know and not
just copy the code .

Thx again I would pay you a drink if you were here
fuuss
 
Posts: 40
Joined: Wed Mar 19, 2008 3:53 pm
Has thanked: 0 time
Been thanked: 0 time

Re: Merging to members into one

Postby arunprasad.k » Fri Mar 21, 2008 3:09 pm

arunprasad.k
 
Posts: 110
Joined: Thu Dec 27, 2007 5:18 pm
Has thanked: 0 time
Been thanked: 0 time


Return to JCL

 


  • Related topics
    Replies
    Views
    Last post