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
 

 

Inserting Date from input file to another file

 
Post new topic   Reply to topic    IBMMAINFRAMES.com Support Forums -> JCL & VSAM
View previous topic :: :: View next topic  
Author Message
Raj Ponnuchamy

New User


Joined: 09 Sep 2009
Posts: 9
Location: Chennai

PostPosted: Wed Sep 09, 2009 4:02 pm    Post subject: Inserting Date from input file to another file
Reply with quote

Hi,

I have two input files Input 1 and Input 2.Both are FB files.
Input 1 contains only date field. The length of the field is S9(07) COMP-3. The length of Input 1 file is 4.
Input 2 file contains many records. The length of the file is 857.

I need to insert the date field from Input 1 into the input 2 file at the position 32. The length of the target variable in the input 2 file is also S9(07) COMP-3.

Please let me know how i can achieve this through SORT.

Thanks
Back to top
View user's profile Send private message

expat

Global Moderator


Joined: 14 Mar 2007
Posts: 8593
Location: Back in jolly old England

PostPosted: Wed Sep 09, 2009 4:26 pm    Post subject:
Reply with quote

Please specify which sort product is in use at your site as the solution may vary by product.

What happens to any data that already exists in the target position in file 2.

How many records are there in file 1. If more than one, what are the rules for insertion into file 2.
Back to top
View user's profile Send private message
Raj Ponnuchamy

New User


Joined: 09 Sep 2009
Posts: 9
Location: Chennai

PostPosted: Wed Sep 09, 2009 4:40 pm    Post subject: Reply to: Inserting Date from input file to another file
Reply with quote

Hi,

The product used is SYNCSORT Z/OS UTIL V1R2.


The data already present in file2 should be replaced with the data from file 1.

There will be only one record in the file 1. This record needs to be inserted in the file 2 for all the records at the position 32. There is no rule for this insertion. All the record in file2 should be updated with the data from file 1

Thanks
Back to top
View user's profile Send private message
rockish

Active User


Joined: 05 Jun 2009
Posts: 185
Location: Planet Earth

PostPosted: Wed Sep 09, 2009 5:43 pm    Post subject:
Reply with quote

Couple of things..

I really wonder if anybody will give you a clarification on SYNCSORT int his board.. This is exclusive for DFSORT related products..

Next thing is, you still were not clear about what happens to the data that already exists at 32nd position !!! Should they be moved to the right or replaced with the four bytes from file1 ??

The following JCL's will work with DFSORT ICETOOL:

Case 1:
Moving the data after 32nd position to the right
Code:
//ICETOOL0 EXEC PGM=ICETOOL                                     
//TOOLMSG  DD SYSOUT=*                                         
//DFSMSG   DD SYSOUT=*                                         
//IN1      DD *                                                 
//IN2      DD *                                                 
//T1       DD DSN=&&T1,DISP=(MOD,PASS),SPACE=(CYL,(1,1),RLSE)   
//OUTPUT   DD SYSOUT=*                                         
//TOOLIN   DD *                                                 
  COPY FROM(IN1) USING(CTL1)                                   
  COPY FROM(IN2) USING(CTL2)                                   
  SPLICE FROM(T1) TO(OUTPUT) USING(CTL3) ON(862,1,CH) WITH(1,31) -
  WITH(36,826) WITHALL KEEPNODUPS                                 
//CTL1CNTL DD *                                                 
  OUTFIL FNAMES=T1,OUTREC=(32:1,4,862:C'0')                       
//CTL2CNTL DD *                               
  OUTFIL FNAMES=T1,OUTREC=(1:1,31,36:32,826,862:C'0')
//CTL3CNTL DD *                               
  OUTFIL FNAMES=OUTPUT,BUILD=(1,861)


Case 2:
Replacing the data in 32-35 position
Code:
//ICETOOL0 EXEC PGM=ICETOOL                                     
//TOOLMSG  DD SYSOUT=*                                         
//DFSMSG   DD SYSOUT=*                                         
//IN1      DD *                                                 
//IN2      DD *                                                 
//T1       DD DSN=&&T1,DISP=(MOD,PASS),SPACE=(CYL,(1,1),RLSE)   
//OUTPUT   DD SYSOUT=*                                         
//TOOLIN   DD *                                                 
  COPY FROM(IN1) USING(CTL1)                                   
  COPY FROM(IN2) USING(CTL2)                                   
  SPLICE FROM(T1) TO(OUTPUT) USING(CTL3) ON(862,1,CH) WITH(1,857) -
  WITHALL KEEPNODUPS                                 
//CTL1CNTL DD *                                                 
  OUTFIL FNAMES=T1,OUTREC=(32:1,4,858:C'0')                       
//CTL2CNTL DD *                               
  OUTFIL FNAMES=T1,OUTREC=(1:1,857,858:C'0')
//CTL3CNTL DD *                               
  OUTFIL FNAMES=OUTPUT,BUILD=(1,857)


Of course, Frank/Kolusu may suggest a better piece of code with DFSORT/ICETOOL..
Back to top
View user's profile Send private message
Raj Ponnuchamy

New User


Joined: 09 Sep 2009
Posts: 9
Location: Chennai

PostPosted: Wed Sep 09, 2009 6:04 pm    Post subject: Reply to: Inserting Date from input file to another file
Reply with quote

Hi,

Thanks for the update.

As for the question

"Next thing is, you still were not clear about what happens to the data that already exists at 32nd position !!! Should they be moved to the right or replaced with the four bytes from file1 ?? "

The data already existing in 32 - 35 position in file 2 should be replaced with the four bytes data from file 1.

Is it possible to achieve this using SORT instead of ICETOOL ?

Thanks,
Back to top
View user's profile Send private message
rockish

Active User


Joined: 05 Jun 2009
Posts: 185
Location: Planet Earth

PostPosted: Wed Sep 09, 2009 6:08 pm    Post subject:
Reply with quote

I never handled two files using SORT so far !!!!! (Unless its a MERGE functionality)

If you are still particular about the usage of SORT, you might need to pass the four bytes as a symbolic variable rather than a separate file..

Somebody pls correct me if SORT can handle multiple input files !!
Back to top
View user's profile Send private message
rockish

Active User


Joined: 05 Jun 2009
Posts: 185
Location: Planet Earth

PostPosted: Wed Sep 09, 2009 6:20 pm    Post subject:
Reply with quote

If you are okay with using symbolic variables, following code will help,

Code:
//SORT000 EXEC PGM=SORT       
//SYSOUT   DD SYSOUT=*         
//SYMNAMES DD *               
MYPARM,X'F0F0F0F0'               
//SORTIN   DD DSN=<INPUT>,DISP=SHR
//SORTOUT  DD SYSOUT=*         
//SYSIN   DD *                 
  SORT FIELDS=COPY             
  OUTREC OVERLAY=(32:MYPARM)
Back to top
View user's profile Send private message
Raj Ponnuchamy

New User


Joined: 09 Sep 2009
Posts: 9
Location: Chennai

PostPosted: Thu Sep 10, 2009 1:07 pm    Post subject: Reply to: Inserting Date from input file to another file
Reply with quote

Hi,

Actually this sort job will be running daily and the value in the file1 will be changing daily. So it would be better if the values are obtained from file1 instead of hard coding the value directly in the sort card.

Thanks
Back to top
View user's profile Send private message
rockish

Active User


Joined: 05 Jun 2009
Posts: 185
Location: Planet Earth

PostPosted: Thu Sep 10, 2009 2:04 pm    Post subject:
Reply with quote

I really wonder if you tried any of the JCL's I posted or simply raising questions..

Tell me why you want to use SORT and not XXXXTOOL. I have given you the JCL to get your requirement done using ICETOOL. SyncSort has its equivalent in the name of SYNCTOOL which I think also has an alias ICETOOL. I would suggest you to give atleast few minutes of YOUR effort in getting your requirement done.

I would like to quote the words of EXPAT from a different post,

Quote:
Please note DO NOT just ask for code without showing your own attempts. This is a HELP forum, not a do it for me forum.
Back to top
View user's profile Send private message
Raj Ponnuchamy

New User


Joined: 09 Sep 2009
Posts: 9
Location: Chennai

PostPosted: Thu Sep 10, 2009 3:45 pm    Post subject: Reply to: Inserting Date from input file to another file
Reply with quote

Hi,

I was told that i should not use ICETOOL for this task in my concern. I dont know the reason for this.

Thanks for the help. I will try to achieve this by Sort.
Back to top
View user's profile Send private message
rockish

Active User


Joined: 05 Jun 2009
Posts: 185
Location: Planet Earth

PostPosted: Thu Sep 10, 2009 4:31 pm    Post subject:
Reply with quote

Cool, do share the JCL with me once you are done. As am really curious to know how SORT can handle two files !!
Back to top
View user's profile Send private message
Arun Raj

Moderator


Joined: 17 Oct 2006
Posts: 2168
Location: @my desk

PostPosted: Thu Sep 10, 2009 4:32 pm    Post subject:
Reply with quote

rockish wrote:
I never handled two files using SORT so far !!!!! (Unless its a MERGE functionality)
rockish,

I am not sure which product you meant here by 'SORT'. But AFAIK a SyncSort JOIN application can have two input files.

Raj Ponnuchamy,

You can slightly modify the solution posted above like this to make it work for your requirement. This is untested. Give it a try. Good luck
Code:
//SORT001 EXEC PGM=SORT       
//SYSOUT   DD SYSOUT=*         
//SORTIN   DD DSN= Date-file (FB/LRECL=4)               
//SORTOUT  DD DSN=&&T1,DISP=(,PASS)         
//SYSIN    DD *                 
  SORT FIELDS=COPY             
  OUTREC BUILD=(C'DATE-X,''',1,4,C'''',80:X)
//SORT002 EXEC PGM=SORT       
//SYSOUT   DD SYSOUT=*         
//SYMNAMES DD DSN=&&T1,DISP=(OLD,PASS)             
//SORTIN   DD DSN= Input-file  (FB/LRECL=857)               
//SORTOUT  DD DSN= Output-file (FB/LRECL=857)           
//SYSIN   DD *                 
  INREC OVERLAY=(32:DATE-X)
  SORT FIELDS=COPY             
Back to top
View user's profile Send private message
rockish

Active User


Joined: 05 Jun 2009
Posts: 185
Location: Planet Earth

PostPosted: Thu Sep 10, 2009 7:31 pm    Post subject:
Reply with quote

Arun,
I think that may work with most of the SORT products icon_smile.gif

I have actually never used SYMNAMES that way !!!! Anyway, I learnt one more stuff today icon_smile.gif

Thanks for sharing..
Back to top
View user's profile Send private message
Arun Raj

Moderator


Joined: 17 Oct 2006
Posts: 2168
Location: @my desk

PostPosted: Thu Sep 10, 2009 7:33 pm    Post subject:
Reply with quote

rockish wrote:
Arun,
I think that may work with most of the SORT products icon_smile.gif
What??? icon_rolleyes.gif
Back to top
View user's profile Send private message
rockish

Active User


Joined: 05 Jun 2009
Posts: 185
Location: Planet Earth

PostPosted: Thu Sep 10, 2009 8:31 pm    Post subject:
Reply with quote

OMG.. u mistook wat i said.. i stressed on something else

Quote:
I think that may work with most of the SORT products


All I meant to say was, your solution will work with other products too !!!!
Back to top
View user's profile Send private message
Arun Raj

Moderator


Joined: 17 Oct 2006
Posts: 2168
Location: @my desk

PostPosted: Thu Sep 10, 2009 10:14 pm    Post subject: Reply to: Inserting Date from input file to another file
Reply with quote

Sorry for the confusion. Actually I thought u were saying "SyncSort JOIN will work with most of the sort products"
Back to top
View user's profile Send private message
Raj Ponnuchamy

New User


Joined: 09 Sep 2009
Posts: 9
Location: Chennai

PostPosted: Fri Sep 11, 2009 12:44 pm    Post subject: Reply to: Inserting Date from input file to another file
Reply with quote

Arun,

I have tested the sort code you provided and it worked as per my requirement. Thanks for the help.
Back to top
View user's profile Send private message
Arun Raj

Moderator


Joined: 17 Oct 2006
Posts: 2168
Location: @my desk

PostPosted: Fri Sep 11, 2009 7:47 pm    Post subject:
Reply with quote

You're welcome.
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 -> JCL & VSAM All times are GMT + 6 Hours
Page 1 of 1

 

Search our Forum:

Similar Topics
Topic Author Forum Replies Posted
No new posts Performing arithmetic on input field zh_lad DFSORT/ICETOOL 22 Tue Dec 06, 2016 8:04 pm
No new posts High CPU consumption Job using IAM fi... aswinir JCL & VSAM 8 Thu Dec 01, 2016 8:28 pm
No new posts Add PD field from 2nd file to PD in 1st Sushant Garje DFSORT/ICETOOL 6 Thu Dec 01, 2016 4:32 pm
No new posts File Aid to File Manager conversion murali3955 IBM Tools 4 Thu Nov 24, 2016 3:41 pm
No new posts How to convert the VBM file to VB or... Sulabh Agrawal JCL & VSAM 4 Fri Nov 18, 2016 1:04 pm


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