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
 

 

Compare VSAM and GDG file and create new file.

 
Post new topic   Reply to topic    IBMMAINFRAMES.com Support Forums -> DFSORT/ICETOOL
View previous topic :: :: View next topic  
Author Message
rguhanath

New User


Joined: 16 Oct 2006
Posts: 80
Location: chennai

PostPosted: Tue May 13, 2008 12:58 pm    Post subject: Compare VSAM and GDG file and create new file.
Reply with quote

Hi All,

i have one query...

i have two files. one is VSAM and another onc is flat GDG file. i want the out put file with using these two files which i explained below.i have to do this using any JCL utilities with out write any new program. please help me write a JCL step for this.

in VSAM file i have records with two fields like:

Code:

FLD1   FLD2
====   ====
1       0  --> Rec1
2       0  --> Rec2
3       3  --> Rec3
4       2  --> Rec4
5       0  --> Rec5
6       0  --> Rec6
7       0  --> Rec7
8       0  --> Rec8
9       3  --> Rec9
10      0  --> Rec10
11      0  --> Rec11
12      0  --> Rec12
13      3  --> Rec13
14      0  --> Rec14
15      2  --> Rec15


in GDG file i have records with one field:

Code:

FLD1
====
3   --> Rec1
5   --> Rec2
6   --> Rec3
7   --> Rec4
8   --> Rec5
1   --> Rec6
13           --> Rec7
9   --> Rec8
15           --> Rec9
2   --> Rec10


I want the output file(GDG or Flat file) from GDG using VSAM like:

Code:

FLD1   FLD2(this will pick from VSAM file)
====   ====
3       3   --> Rec1
5       0   --> Rec2
6       0   --> Rec3
7       0   --> Rec4
8       0   --> Rec5
1       0   --> Rec6
13       3         --> Rec7
9       3   --> Rec8
15       2         --> Rec9
2       0   --> Rec10


Please help to write the JCL.

Thanks and Regards,
Nath R.
Back to top
View user's profile Send private message

krisprems

Active Member


Joined: 27 Nov 2006
Posts: 649
Location: India

PostPosted: Tue May 13, 2008 2:02 pm    Post subject:
Reply with quote

Below is the example, which you can modify as per your need.

Code:
//*****************************************************
//STEP001  EXEC PGM=ICETOOL                           
//TOOLMSG  DD SYSOUT=*                                 
//DFSMSG   DD SYSOUT=*                                 
----+----1----+----2----+----3----+----4----+----5----+
//IN1      DD *                                       
1       0                                             
2       0                                             
3       3                                             
4       2                                             
5       0                                             
6       0                                             
7       0                                             
8       0                                             
9       3                                             
10      0                                             
11      0                                             
12      0                                             
13      3                                             
14      0                                                             
15      2                                                             
/*                                                                   
//IN2      DD *                                                       
3                                                                     
5                                                                     
6                                                                     
7                                                                     
8                                                                     
1                                                                     
13                                                                   
9                                                                     
15                                                                   
2                                                                     
/*                                                                   
//TMP1     DD DSN=&&TEMP1,DISP=(MOD,PASS),SPACE=(TRK,(5,5)),UNIT=SYSDA
//BOTH     DD SYSOUT=*                                               
//TOOLIN   DD *                                                       
 COPY FROM(IN2)  TO(TMP1) USING(CP01)                                 
 COPY FROM(IN1)  TO(TMP1) USING(CP02)                       
 SPLICE FROM(TMP1) TO(BOTH) ON(1,2,CH) WITH(9,1) WITH(13,1)-
                            USING(CP03)                     
/*                                                           
//CP01CNTL DD   *                                           
  OUTREC BUILD=(1,10,12:C'11')                               
/*                                                           
//CP02CNTL DD   *                                           
  OUTREC BUILD=(1,10,12:C'22')                               
/*                                                           
//CP03CNTL DD   *                                           
  OUTFIL FNAMES=BOTH,INCLUDE=(12,2,CH,EQ,C'12'),BUILD=(1,10)
/*                                                           



The final o/p would be in sorted order as shown below...let me knif it was needed in the original order as you have shown
Code:
1       0   
13      3   
15      2   
2       0   
3       3   
5       0   
6       0   
7       0   
8       0   
9       3   
Back to top
View user's profile Send private message
Frank Yaeger

DFSORT Moderator


Joined: 15 Feb 2005
Posts: 7130
Location: San Jose, CA

PostPosted: Tue May 13, 2008 9:07 pm    Post subject:
Reply with quote

Nath R.,

VSAM files require a bit different handling than DD * files, and SELECT would be a better choice than SPLICE here.

However, to give you a solution, I need to know the RECFM and LRECL of the GDG file.
Back to top
View user's profile Send private message
rguhanath

New User


Joined: 16 Oct 2006
Posts: 80
Location: chennai

PostPosted: Wed May 14, 2008 1:17 pm    Post subject:
Reply with quote

Hi Frank and all,

Thanks for your reply..

Here i am giving my requirement.

i have two files one is VSAM(v.v.v) and another is GDG file (g.g.g(0))

(legends:

reqfiled = Required field from VSAM to OUTPUT FILE.
DATA1 = Data in VSAM
DATA = Data in GDG (in vsam data and GDG data are different, only key fields are same))



1)in VSAM file the length is 383 and it indexed seq file. First three fields are comb key fields. like


1--------------------------------------------------------------------------------383
keyfild1,(+)keyfiled2,(+)keyfield3,data1....,reqfield1,data2......,reqfield2,data3
==================================
^
combination key

Keyfield2 and keyfield3 are BINARY format fields. remaining are CHAR format.


records are like in VSAM
========================
AAA111222DATAa.......REQaDATAz........REQzDATA
AAA222222DATAb.......REQbDATAy........REQyDATA
AAA111333DATAc.......REQcDATAx........REQxDATA
BBB111222DATAd.......REQdDATAw........REQwDATA
:
:
:
:
ZZZ111222DATAz.......REQ1DATAa........REQ2DATA


2)GDG file i have like. (RECFMT=VB, LENTH=454)


1-----------------------------------------------101-----------------------------454
keyfild1,|,keyfiled2,|,keyfield3,|,DATA............SPACES.......................

AAA|222|222|DATA..................SPACES........................................
BBB|111|222|DATA..................SPACES........................................
AAA|111|333|DATA..................SPACES........................................
:
:
:
ZZZ|111|222|DATA..................SPACES........................................
:
:
BBB|111|222|DATA..................SPACES........................................ (DUP TO 2ND)
:
:


3)I want the output file like..(reqfield1,reqfield2 needs to be populate from vsam file)

1-----------------------------------------------101(starts SPACES),102(starts reqfield1 and continues reqfield2 and SPACES)-----------------------------454
keyfild1,|,keyfiled2,|,keyfield3,|,DATA.............reqfield1,reqfield2,SPACES......

AAA|222|222|DATA..................|REQb|REQy|SPACES.................................
BBB|111|222|DATA..................|REQd|REQw|SPACES.................................
AAA|111|333|DATA..................|REQc|REQx|SPACES.................................
:
:
:
ZZZ|111|222|DATA..................|REQ1|REQ2|SPACES.................................
:
:
BBB|111|222|DATA..................|REQd|REQw|SPACES................................. (DUP TO 2ND)
:
:


Please help to write a jcl.

Thanks and Regards,
Nath R
Back to top
View user's profile Send private message
Skolusu

Senior Member


Joined: 07 Dec 2007
Posts: 2205
Location: San Jose

PostPosted: Wed May 14, 2008 10:10 pm    Post subject: Reply to: Compare VSAM and GDG file and create new file.
Reply with quote

Nath,

I still need some clarification.

1. what is the cobol definitions for keyfild1,keyfiled2,keyfield3 in vsam file and what are postions of these fields in the vsam file.

2. Can the combo of keyfild1,keyfiled2,keyfield3 in the VSAM file have dups? If it has then from which dup record do we need to be pick the required fields data?

3. what is the cobol definitions for keyfild1,keyfiled2,keyfield3 in GDG file and what are postions of these fields in the GDG file?

4. Can the combo of keyfild1,keyfiled2,keyfield3 in the GDG file have dups? if so do you need the duplicates to be retained?

5. Do you want the output file to be a VB file or FB file?

Kolusu
Back to top
View user's profile Send private message
rguhanath

New User


Joined: 16 Oct 2006
Posts: 80
Location: chennai

PostPosted: Thu May 15, 2008 2:28 pm    Post subject:
Reply with quote

Hi Kolusu,

Thanks for your reply. Below is the answers for your Qs

1. keyfield1 - Alpha Numeric - length 3 - 1-3 pos
keyfield2 - Binary - length 4 - 4-7 pos
keyfield3 - Binary - length 4 - 8 -11 pos

2. we dont have any dups in the combkeys. we have unique.. please look at below example data in VSAM file.

Quote:

Keyfield2 and keyfield3 are BINARY format fields. remaining are CHAR format.


records are like in VSAM
========================
AAA 111 222 DATAa.......REQaDATAz........REQzDATA
AAA 222 222 DATAb.......REQbDATAy........REQyDATA
AAA 111 3331DATAc.......REQcDATAx........REQxDATA
BBB 1111222 DATAd.......REQdDATAw........REQwDATA
:
:
:
:
ZZZ 111 222 DATAz.......REQ1DATAa........REQ2DATA



3. keyfield1 - Alpha Numeric - 1-3 pos
keyfield2 - Alpha Numeric - length 4
keyfield3 - Alpha Numeric - length 4

in this keyfield2 anad keyfield3 are not have fixed positions per each record. it vary by '|' symbole like ...

(please see the first three fields in each records. above i have give only the max length for these three keyfields)
AAA|222|222|DATA..................SPACES........................................
BBB|1111|222|DATA..................SPACES........................................
AAA|111|3331|DATA..................SPACES........................................

in this we duplicate combination keys..but this is just only GDG file.

4. i want out put file in VB format.

Please let me know if any thing else.

Thanks and Regards,
Nath R.
Back to top
View user's profile Send private message
Skolusu

Senior Member


Joined: 07 Dec 2007
Posts: 2205
Location: San Jose

PostPosted: Thu May 15, 2008 9:39 pm    Post subject: Reply to: Compare VSAM and GDG file and create new file.
Reply with quote

Nath,

The vsam file key has two 4 byte binary fields as part of the key. A 4 byte binary field is stored in a full word and it can store values ranging from -2,147,483,648 through +2,147,483,647.

The corresponding key in GDG is only 4 byte numeric which would only store a max of 9999. Now what happens if the vsam key has a value greater than 9999 ?

Also what is the length and pos of the required data1 & dat2 to be pulled from the vsam file.
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 -> DFSORT/ICETOOL All times are GMT + 6 Hours
Page 1 of 1

 

Search our Forum:

Similar Topics
Topic Author Forum Replies Posted
No new posts Changing of LRECL of a file abdulrafi DFSORT/ICETOOL 2 Fri Mar 24, 2017 3:25 pm
No new posts splitting a file abdulrafi DFSORT/ICETOOL 4 Fri Mar 24, 2017 11:51 am
No new posts Receive a file using PCOMM macro Harald.v.K IBM Tools 0 Thu Mar 23, 2017 6:50 pm
No new posts Export flat file data into excel sheet murali.andaluri DFSORT/ICETOOL 2 Mon Mar 20, 2017 5:39 pm
No new posts Formatting VB File Learncoholic DFSORT/ICETOOL 3 Mon Mar 20, 2017 12:29 pm


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