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
 

 

Insert a value with JCL

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

New User


Joined: 03 Jul 2014
Posts: 27
Location: Italy

PostPosted: Mon Feb 16, 2015 7:14 pm    Post subject: Insert a value with JCL
Reply with quote

Hello,

I have to solve a problem.

I have a file where, for the same key, I removed duplicate records writing in a second file.

After processing the first file (without keys doubles) I need to insert a value in the second file with the same key.


example:


file 1

Code:
Key Value
001
001
001
002
002
003



Removing duplicate keys

file 1
Code:
Key  Value
001
002
003


file 2
Code:
Key Value
001
001
002



File 1 after processing

Code:
Key Value
001 555
002 666
003 777



Output file

Code:
Key Value
001 555
001 555
001 555
002 666
002 666
003 777


I need you help.

Thank you.
Back to top
View user's profile Send private message

Bill Woodger

DFSORT Moderator


Joined: 09 Mar 2011
Posts: 7225

PostPosted: Mon Feb 16, 2015 7:37 pm    Post subject: Reply to: Insert a value with JCL
Reply with quote

Your final output just looks like your original file with some extra stuff (source unknown) added to it.
Back to top
View user's profile Send private message
danylele74

New User


Joined: 03 Jul 2014
Posts: 27
Location: Italy

PostPosted: Mon Feb 16, 2015 7:42 pm    Post subject:
Reply with quote

yes. It's the same file but with the "value" field filled after processing
Back to top
View user's profile Send private message
Bill Woodger

DFSORT Moderator


Joined: 09 Mar 2011
Posts: 7225

PostPosted: Mon Feb 16, 2015 7:47 pm    Post subject: Reply to: Insert a value with JCL
Reply with quote

OK, but where do the new values come from and how are they applied? You want to do this with your SORT product? Which one do you have?
Back to top
View user's profile Send private message
danylele74

New User


Joined: 03 Jul 2014
Posts: 27
Location: Italy

PostPosted: Mon Feb 16, 2015 8:08 pm    Post subject:
Reply with quote

The "original" file is

Code:

Key               Fied-X
001
001
001
002
002
003



The original file without duplicate key (called NODUP)

Code:

Key               Fied-X
001
002
003



The original file with ONLY duplicate key (called DUP)

Code:

Key               Fied-X
001
001
002



File NODUP after processing (processed by a program)

Code:

Key               Fied-X
001                555
002                666
003                777


The output file (NODUP + DUP)

Code:

Key               Fied-X
001               555
001               555
001               555
002               666
002               666
003               777
Back to top
View user's profile Send private message
Bill Woodger

DFSORT Moderator


Joined: 09 Mar 2011
Posts: 7225

PostPosted: Mon Feb 16, 2015 8:26 pm    Post subject: Reply to: Insert a value with JCL
Reply with quote

OK, it would seem to me that the program which puts the new value one should have no real problem with processing the original file: keep a note of key change; if so, add the value, also save it; if not key change, add the saved value.

For what you have ended up with, use MERGE with OPTION EQUALS and IFTHEN=(WHEN=GROUP with KEYBEGIN to PUSH the value from the first record to all records in the group.
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 Insert Lines in JCL with Rexx after a... Willy Jensen CLIST & REXX 3 Tue Aug 30, 2016 4:18 pm
No new posts How to insert a lengthy string havin... vidyaa DB2 7 Thu Aug 25, 2016 5:20 pm
No new posts How do I right justify a string in an... rakesh17684 DB2 1 Wed Jun 08, 2016 8:01 pm
No new posts insert the same records but chancing ... danylele74 DB2 6 Mon May 02, 2016 7:22 pm
No new posts Can a DB2 insert trigger execution of... TS70363 DB2 6 Tue Nov 24, 2015 10:44 pm


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