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
 

 

Combining data from one file to another 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: Sun May 18, 2008 8:38 pm    Post subject: Combining data from one file to another file.
Reply with quote

Hi All,

i have one more requiremet to do using jcl...

i have two files which are having different Record lengths (below i am giving the details) and i want to combine 29th,30th and 34th positions data at the end of the record from file1 using the corresponding record (key positions are from 1 to 11) in file2 and creates a new file with out change the record positions(output file shold be as file2 record positions) after merging.

File1: A.B.C (LRECL=300,RECFM=FB)
(key positions are from 1 to 11)

Code:

(START THE FILE)
1------------------------------------38----------------300
AAA 111 222 DATADATADATADATAR1DAT1DATA
AAA 222 222 DAT232DATA4FLD3AR2DTA1DATA
BBB 111 111 APP4332LDATLADLLA3DAL2DADD
AAA 222 111 SDJLKDLDJFLDLLDFL3LLD1LDLS
AAA 333 333 DLJDFJDFLDFJLDDFR4DSD2DFDD
CCC 111 111 DFDFDDFDFDFDFDFDW2DDS1DDDS
BBB 222 111 FDFDFDASDEERGFDAR3DFD3DFDS
(END OF THE FILE)



FILE2: AA.BB.CC(LRECL=500,RECFM=FB,fields are seperated by '|')
(key positions are from 1 to 11)

Code:

(START THE FILE)
1-----------------------------------------------------------------------------------------500
AAA 111 222 DIF|FDI|FF|3DI|FF|L|DLS|LDJ|F|||LLSD|
CCC 111 111 DF|DD|ASD|FD|F|DLJKL|KJ|EOI|D|OKD|FIDK|HJ|DFOHDF||
DDD 443 222 DF|DFD|FD|FDF|DF|DFA|SDGG|FDS|AA|AD|SFD|SAD|SFA
BBB 222 111 KL|LKJ|OJD|HH|IU|IE|RH|DISJ|HIUD|HKS|ASDK|JK|HD|
AAA 444 333 FFG|FGF|SS|SDF|GFDGF|DG|FD|G|FDGSDFG|HG|HF|REW|EREFEW|RE|DFE|ER|ERE
AAA 333 333 I|UEM|DI|HD|KFJI|EL|SJD|OJVFSL|DSO|HFDL|SK|
(END OF THE FILE)


OUTPUT FILE: OO.UU.TT (LRECL=500,RECFM=FB,fields are seperated by '|')

Code:

(START THE FILE)
1-----------------------------------------------------------------------------------------500
AAA 111 222 DIF|FDI|FF|3DI|FF|L|DLS|LDJ|F|||LLSD|R1|1|
CCC 111 111 DF|DD|ASD|FD|F|DLJKL|KJ|EOI|D|OKD|FIDK|HJ|DFOHDF||W2|1|
DDD 443 222 DF|DFD|FD|FDF|DF|DFA|SDGG|FDS|AA|AD|SFD|SAD|SFA
BBB 222 111 KL|LKJ|OJD|HH|IU|IE|RH|DISJ|HIUD|HKS|ASDK|JK|HD|R3|3|
AAA 444 333 FFG|FGF|SS|SDF|GFDGF|DG|FD|G|FDGSDFG|HG|HF|REW|EREFEW|RE|DFE|ER|ERE
AAA 333 333 I|UEM|DI|HD|KFJI|EL|SJD|OJVFSL|DSO|HFDL|SK|R4|2|
(END OF THE FILE)


Like this i am having more than 200,000 records in the both files.
Please help to do this using DFSORT and 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: Mon May 19, 2008 10:20 pm    Post subject:
Reply with quote

rguhanath,


The following DFSORT/ICETOOL JCL will give you the desired results.


Code:

//STEP0100 EXEC PGM=ICETOOL
//TOOLMSG  DD SYSOUT=*     
//DFSMSG   DD SYSOUT=*     
//IN1      DD DSN=Your 500 byte lrecl file,
//            DISP=SHR
//IN2      DD DSN=Your 300 byte lrecl file,
//            DISP=SHR
//T1       DD DSN=&&T1,DISP=(MOD,PASS),SPACE=(CYL,(X,Y),RLSE)     
//T2       DD DSN=&&T2,DISP=(,PASS),SPACE=(CYL,(X,Y),RLSE)       
//OUT      DD DSN=your output file,
//            DISP=(NEW,CATLG,DELETE),
//            UNIT=SYSDA,
//            SPACE=(CYL,(X,Y),RLSE)
/*
//TOOLIN   DD *                                                   
  COPY FROM(IN1) USING(CTL1)                                     
  COPY FROM(IN2) USING(CTL2)                                     
  SPLICE FROM(T1) TO(T2) ON(1,11,CH) -                           
  KEEPNODUPS WITHALL WITH(509,4) USING(CTL3)                     
  SORT FROM(T2) USING(CTL4)                                       
//CTL1CNTL DD *                                                   
  OUTFIL FNAMES=T1,OVERLAY=(501:SEQNUM,8,ZD,4X)                   
//CTL2CNTL DD *                                                   
  OUTFIL FNAMES=T1,BUILD=(1,11,489X'FF',501:8X,29,2,C'|',34,1)   
//CTL3CNTL DD *                                                   
  OUTFIL FNAMES=T2,                                               
  OMIT=(501,8,CH,EQ,C' ')                                         
//CTL4CNTL DD *                                                   
  SORT FIELDS=(501,8,CH,A)                                       
  OUTFIL FNAMES=OUT,BUILD=(1,500,509,4)                           
/*


Hope this helps...

Cheers

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

New User


Joined: 16 Oct 2006
Posts: 80
Location: chennai

PostPosted: Tue May 20, 2008 12:27 pm    Post subject:
Reply with quote

Hi Skolusu,

Many Many Thanks.

its working fine. Thanks once again for put your efforts on my problem.

according to your logic, the 29-30,34 positions are included at the last of the records( by increasing the length of the record size). actually i want it like "L|DLS|LDJ|F|||LLSD|R1|1|". any way this is also ok by increasing the record size..Thx.

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: Tue May 20, 2008 9:09 pm    Post subject:
Reply with quote

rguhanath wrote:
Hi Skolusu,

Many Many Thanks.

its working fine. Thanks once again for put your efforts on my problem.

according to your logic, the 29-30,34 positions are included at the last of the records( by increasing the length of the record size). actually i want it like "L|DLS|LDJ|F|||LLSD|R1|1|". any way this is also ok by increasing the record size..Thx.

Regards,
Nath R.


Change your CTL3 and CTL4 control cards to the following and re-run your job.

Code:

//CTL3CNTL DD *                                             
  OUTFIL FNAMES=T2,BUILD=(1,500,509,4,501,8),               
  OMIT=(501,8,CH,EQ,C' ')                                   
//CTL4CNTL DD *                                             
  SORT FIELDS=(505,8,CH,A)                                 
  OUTFIL FNAMES=OUT,BUILD=(1,504,SQZ=(SHIFT=LEFT,MID=C'|'))
/*
Back to top
View user's profile Send private message
rguhanath

New User


Joined: 16 Oct 2006
Posts: 80
Location: chennai

PostPosted: Wed May 21, 2008 11:22 am    Post subject:
Reply with quote

Hi Skolusu,

Excellent help from your side to me..!! Thanks once again... its working very fine.

Quote:

BUILD=(1,504,SQZ=(SHIFT=LEFT,MID=C'|'))


Can you please explain me the above statement that how it will work in the record.

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

New User


Joined: 16 Oct 2006
Posts: 80
Location: chennai

PostPosted: Wed May 21, 2008 7:52 pm    Post subject:
Reply with quote

Hi Skolusu/All,

i need one more change on this.your previous logic is working fine. below i was explain regarding my change.

in the in put file i am having spaces between two '|' delimiters. like.

Quote:

dk|f|lsa|jld|fsld|fj|flj|a df|jld|skldf| -do- |c|1


so when i am using ur logic it puts delimiter where is the space in the value like |a|df|

exact requirement is....

in the input file we have delimiters are 10 (10 delimiters should be there in each record, because fields count are 11 which are seperated by '|') like..

Code:


1------------------------------------------------------------------------500
FLD1|FLD2|FLD3|FLD4|FLD5|FLD6|FLD7|FLD8|FLD9|FLD10|FLD11      |FLD12|FLD13

(FLD11 LENGTH IS 25) (FLD12 AND FLD13 ARE NEW FIELDS INTRODUCED IN THIS FILE)



FLD11 value also might be have like 'SSSSSdsfsadSSSSSSdSSSSSSS' (S is the spaces) . so at this time i need like 'SSSSSdsfsadSSSSSSd|3|4'

Code:

1--------------------------------------------------------------------------500

ldfdsd|dfd  dfd|fds|||sdd||dss|d|sa|       <--spaces/blanks-->          |3|4
dsa|sasd|d|d   s||ds|d||d|d|                      --do--                |2|a
asdsad|sddfdsd|dfdsda|dfdd|||dsfds|ds|dsd|fdfds|adfd      --do--        |2|1
adfd|sd|dfd||dsd|sd    df|dfds|df|s||             --do--                |1|b
a  fd|dsdf|ds||df|df|dfd|||                       --do--                |c|1
ada|dfd|dfds|dfsddf|sdfs|dfs|dfsdfs|dfsf|sdf|sdfds|--do--               |1|1


i want the output file like...

Code:


1---------------------------------------------------------------------------500

ldfdsd|dfd  dfd|fds|||sdd||dss|d|sa||3|4
dsa|sasd|d|d   s||ds|d||d|d||2|a
asdsad|sddfdsd|dfdsda|dfdd|||dsfds|ds|dsd|fdfds|adfd|2|1
adfd|sd|dfd||dsd|sd    df|dfds|df|s|||1|b
a  fd|dsdf|ds||df|df|dfd|||||c|1
ada|dfd|dfds|dfsddf|sdfs|dfs|dfsdfs|dfsf|sdf|sdfds||1|1




please help me to shift the fields from last to end of the each record.

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 21, 2008 10:26 pm    Post subject: Reply to: Combining data from one file to another file.
Reply with quote

Nath,

It gets little tricky to preserve the blanks between the delimiters. So we use ALTSEQ to change the delimiter '|'(x'4f' to a Quote (x'7f') inorder to preserve the blanks within the fields. Once we merged the contents from pos 501 then we change the Quote to delimter '|' once again using another ALTSEQ. Change your CTL3 and CTL4 control cards to the following and re-run your job.

Code:

//CTL3CNTL DD *                                                     
  OUTFIL FNAMES=T2,BUILD=(1,500,TRAN=ALTSEQ,509,4,501,8),           
  OMIT=(501,8,CH,EQ,C' ')                                           
  ALTSEQ CODE=(4F7F)                                                 
//CTL4CNTL DD *                                                     
  SORT FIELDS=(505,8,CH,A)                                           
  INREC BUILD=(1,504,SQZ=(SHIFT=LEFT,PAIR=QUOTE,MID=C'|'),505:505,8)
  OUTFIL FNAMES=OUT,BUILD=(1,504,TRAN=ALTSEQ)                       
  ALTSEQ CODE=(7F4F)                                                 


JFY anD SQZ functions are explained in detail here along with examples

http://www.ibm.com/systems/support/storage/software/sort/mvs/peug/pdf/sortpeug.pdf

Hope this helps...

Cheers
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 SORTJOIN - Copy Matched and Unmatched... Steve Ironmonger DFSORT/ICETOOL 5 Tue Jan 17, 2017 4:26 pm
No new posts Storing huge volume of data, compare ... Pradeep K M All Other Mainframe Topics 3 Mon Jan 16, 2017 5:08 pm
No new posts how to recover an uncataloged VSAM da... archanamuthukrishnan All Other Mainframe Topics 3 Wed Jan 11, 2017 6:18 pm
No new posts HALDB data refresh/copy from producti... vineetanand2007 IMS DB/DC 0 Mon Jan 02, 2017 11:16 am
No new posts Copy RECFM =VB TO FB file with RECL =... sahil41352 DFSORT/ICETOOL 3 Wed Dec 28, 2016 11:29 pm


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