Portal | Manuals | References | Downloads | Info | Programs | JCLs | Mainframe wiki | Quick Ref
IBM Mainframe Computers Forums Index
 
Register
 
IBM Mainframe Computers Forums Index Mainframe: Search IBM Mainframe Forum: FAQ Memberlist Profile Log in to check your private messages Log in
 
Copying one filed of a file to other

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

Active User


Joined: 20 Sep 2008
Posts: 102
Location: Bangalore

PostPosted: Mon Nov 17, 2008 1:33 pm    Post subject: Copying one filed of a file to other
Reply with quote

Hi all,

I faced one new problem while doing my work. Please help me out.

I am having two files.

FILE 1
Code:

---------------
--------------   These four are the header lines
--------------
--------------
a 3 ram
b 4 shyam
c 5 Ravi
-----------   trailer line


FILE 2

Code:

a 7
b 8
c 9

Could you please tell me how to get the following output,

Code:

---------------
--------------   These four are the header lines
--------------
--------------
a 7 3 ram
b 8 4 shyam
c 9 5 Ravi
-----------   trailer line



I suppose i am clear with my problem. Please tell me if anybody can help me out.

Thanks in advance
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: Mon Nov 17, 2008 11:19 pm    Post subject:
Reply with quote

Is that what your records really look like? If not, please show an example of input and output records with the real records.

Do you always have 4 header lines? Do you always have 1 trailer line?

Do you always have 4 data records in each file or can you have more or less?

Do you want to "match" the data records by the key (e.g. 'a' of input file1 with 'a' of input file2, etc) or by the data record number (e.g. data record 1 of input file1 with data record 1 of input file2, etc)?

What is the RECFM and LRECL of input file1? What is the RECFM and LRECL of input file2? What is the starting position, length and format of each relevant field?
Back to top
View user's profile Send private message
Niki

Active User


Joined: 20 Sep 2008
Posts: 102
Location: Bangalore

PostPosted: Tue Nov 18, 2008 9:56 am    Post subject:
Reply with quote

Hi Frank,

Thanks for your reply.

Please have a look to my requirement,

Input file1 :- (Lrecl = 80, FB)

Code:

----+----1----+----2----+----3----+----4----+----5----+----6----+----7
       ;     ;     ; aaaaaaa              ;                  ;         ;       
       ;     ;     ;  bbbbb                ;                  ;         ;       
       ;     ;     ;   ccc                   ;                  ;         ;       
       ;     ;     ;    d                     ;                  ;         ;       
       ;     ;     ;                           ;                  ;         ;       
Numb ;MORE ;PT   ;FIRST NAME     ;LAST NAME         ;SSN      ;
11111;0009 ;0005 ;JIM            ;ROSling           ;111111111;
11111;0009 ;0005 ;Jack           ;mariot            ;222222222;
11111;0010 ;0001 ;DICK           ;Marvlet           ;333333333;
11111;0010 ;0001 ;BARRY          ;MALSE             ;444444444;
11111;0010 ;0001 ;JOHN           ;Rabbock           ;555555555;
TOT   :0005


Here the key values are from pos 1 to 5 and 53 to 63.

Similarly i am having one more input file. Such as below,

File 2( Lrecl = 60, FB )
Code:


----+----1----+----2----+----3
Numb ;SSN      ;amt
11111;111111111;000030   
11111;222222222;000050
11111;333333333;000095
11111;444444444;000078
11111;555555555;000094



Here the keys are 1 to 5 and 7 to 15.


If file2 (1 to 5) value = file1( 1to 5) and File 2(7 to 15) value = File 1( 53 to 63)
then it will populate the records in a new file where lrecl = 100, FB,

Code:

----+----1----+----2----+----3----+----4----+----5----+----6----+----7----+----8
       ;     ;     ; aaaaaaa              ;                  ;         ;       
       ;     ;     ;  bbbbb                ;                  ;         ;       
       ;     ;     ;   ccc                   ;                  ;         ;       
       ;     ;     ;    d                     ;                  ;         ;       
       ;     ;     ;                           ;                  ;         ;     
Numb ;MORE ;PT   ;amt      ;FIRST NAME     ;LAST NAME         ;SSN      ;
11111;0009 ;0005 ;000030 ;JIM            ;ROSling             ;111111111;
11111;0009 ;0005 ;000050 ;Jack           ;mariot              ;222222222;
11111;0010 ;0001 ;000095 ;DICK           ;Marvlet             ;333333333;
11111;0010 ;0001 ;000078 ;BARRY          ;MALSE               ;444444444;
11111;0010 ;0001 ;000094 ;JOHN           ;Rabbock             ;555555555;
TOT   :0005


We always have aheader line of 6 line and a trailer of 1 line in the first file and only one header line in the second file.

We can have more than 4 records.

The Data records need to match by the Key only.

I suppose i m clear with my requirement. Please help in solving this prob

Thanks in advance
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: Wed Nov 19, 2008 12:20 am    Post subject:
Reply with quote

Is this line actually in file2?

Code:

Numb ;SSN      ;amt   
Back to top
View user's profile Send private message
Niki

Active User


Joined: 20 Sep 2008
Posts: 102
Location: Bangalore

PostPosted: Wed Nov 19, 2008 11:28 am    Post subject:
Reply with quote

H Frank,

The line that u r asking is a header one.
Yes it was the only one header line that is present in the File 2.
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: Thu Nov 20, 2008 12:01 am    Post subject:
Reply with quote

Ok. Your positions seem a little off

Quote:
File 2(7 to 15) value = File 1( 53 to 63)


7-15 is 9 bytes and 53-63 is 11 bytes so these don't match up. Instead, I assumed the SSN in File1 was from 54-62.


Here's a DFSORT/ICETOOL job that will do what you asked for:

Code:

//S1   EXEC  PGM=ICETOOL
//TOOLMSG   DD  SYSOUT=*
//DFSMSG    DD  SYSOUT=*
//IN1 DD DSN=...  input file1 (FB/80)
//IN2 DD DSN=...  input file2 (FB/60)
//T1 DD DSN=&&T1,UNIT=SYSDA,SPACE=(CYL,(5,5)),DISP=(MOD,PASS)
//OUT DD DSN=...  output file (FB/100)
//TOOLIN DD *
COPY FROM(IN1) TO(T1) USING(CTL1)
COPY FROM(IN2) TO(T1) USING(CTL2)
SPLICE FROM(T1) TO(OUT) ON(101,8,ZD) ON(1,5,CH) ON(64,9,CH) -
  KEEPNODUPS WITH(19,9) USING(CTL3)
/*
//CTL1CNTL DD *
  INREC IFTHEN=(WHEN=(1,5,CH,EQ,C' '),OVERLAY=(101:SEQNUM,8,ZD)),
    IFTHEN=(WHEN=(1,7,CH,EQ,C'TOT   :'),OVERLAY=(101:8C'9')),
    IFTHEN=(WHEN=NONE,
      BUILD=(1,18,28:18,63,101:8C'7'))
/*
//CTL2CNTL DD *
  INREC BUILD=(1,6,19:17,9,64:7,9,101:8C'7')
/*
//CTL3CNTL DD *
  OUTFIL FNAMES=OUT,BUILD=(1,100)
/*


Here's the input file1 records I used:

Code:

       ;     ;     ; aaaaaaa              ;                  ;
       ;     ;     ;  bbbbb                ;                  ;
       ;     ;     ;   ccc                   ;                  ;
       ;     ;     ;    d                     ;                  ;
       ;     ;     ;                           ;                  ;
Numb ;MORE ;PT   ;FIRST NAME     ;LAST NAME         ;SSN      ;
11111;0009 ;0005 ;JIM            ;ROSling           ;111111111;
11111;0009 ;0005 ;Jack           ;mariot            ;222222222;
11111;0010 ;0001 ;DICK           ;Marvlet           ;333333333;
11111;0010 ;0001 ;BARRY          ;MALSE             ;444444444;
11111;0010 ;0001 ;JOHN           ;Rabbock           ;555555555;
TOT   :0005


Here's the input file2 records I used:

Code:

Numb ;SSN      ;amt
11111;111111111;000030
11111;222222222;000050
11111;333333333;000095
11111;444444444;000078
11111;555555555;000094


Here's the output the job produced:

Code:

        ;     ;     ; aaaaaaa              ;                  ;               
        ;     ;     ;  bbbbb                ;                  ;               
        ;     ;     ;   ccc                   ;                  ;             
        ;     ;     ;    d                     ;                  ;           
        ;     ;     ;                           ;                  ;           
 Numb ;MORE ;PT   ;amt      ;FIRST NAME     ;LAST NAME         ;SSN      ;     
 11111;0009 ;0005 ;000030   ;JIM            ;ROSling           ;111111111;     
 11111;0009 ;0005 ;000050   ;Jack           ;mariot            ;222222222;     
 11111;0010 ;0001 ;000095   ;DICK           ;Marvlet           ;333333333;     
 11111;0010 ;0001 ;000078   ;BARRY          ;MALSE             ;444444444;     
 11111;0010 ;0001 ;000094   ;JOHN           ;Rabbock           ;555555555;     
 TOT   :0005                                                                   
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 Copying part of the report using SARBCH Aedulla CA Products 0 Tue Oct 24, 2017 9:24 am
No new posts Execute JCL step based on the content... sprikitik JCL & VSAM 2 Tue Oct 03, 2017 10:03 am
This topic is locked: you cannot edit posts or make replies. PS file data should be passed as symb... d_sarlie JCL & VSAM 15 Tue Oct 03, 2017 5:18 am
No new posts Garbage on output file Hervey Martinez SYNCSORT 4 Wed Sep 27, 2017 12:50 am
No new posts File Aid tool to compare numeric data balaji81_k Compuware & Other Tools 2 Tue Sep 26, 2017 3:35 am

Facebook
Back to Top
 
Job Vacancies | Forum Rules | Bookmarks | Subscriptions | FAQ | Polls | Contact Us