Inserting new record using outrec in JCL

In this Mainframe Forum - You can post your queries on JCL, OS/390 JCL, MVS JCL, z/OS JCL, JES2 & JES3

Moderators: Frank Yaeger, DikDude, Moderator Group

Post Reply
Sun
Member
Posts: 2
Joined: Thu Oct 10, 2013 4:24 pm

Inserting new record using outrec in JCL

Post by Sun » Thu Oct 10, 2013 4:31 pm

Hi,

How to insert new record into a vsam/PS file using outrec in a jcl sort after checking for some conditions like if record 1 is present then insert record 2 and record 3

NicC
Active Member
Posts: 650
Joined: Sun Jul 24, 2011 5:27 pm
Location: Down on the pig farm

Post by NicC » Thu Oct 10, 2013 5:42 pm

You cannot - try looking up OUTREC in the JLC language reference manual. I suspect that you will find that that keyword does not even exist. In general, JCL does not manipulate data - it just tells the OS which programs you want to run and what resources the programs need including, for utility programs, where to find program control cards.

(Edited much later) I missed the word "sort" in your post. What do you mean by "JCL sort" sorting the JCL or in a batch sort? If you are making a sort query what is wrong with the section of the forum immediately following this JCL section. That section is labelled (clearly) Dfsort and (less clearly) Syncsort so whichever sort product you use - and you did not specify - you should post there.

Which sort product do you use - this may affect the control cards required? Look at the messages produced, not the program name in PGM=.
Last edited by NicC on Fri Oct 11, 2013 2:14 am, edited 1 time in total.
Regards
Nic

William Collins
Active Member
Posts: 732
Joined: Thu May 24, 2012 4:07 am

Post by William Collins » Thu Oct 10, 2013 6:45 pm

You can't insert records with OUTREC. You can with OUTFIL. However, it is not clear what you acually want. Perhaps you are combining data from different files, in which case you'd want JOINKEYS.

If none of that helps, please be a lot more specific about what you want. Sample input, expected output, and how you get from one to the other.

DikDude
Moderator
Posts: 1001
Joined: Fri Jul 22, 2011 8:39 am
Location: usa

Post by DikDude » Fri Oct 11, 2013 1:22 am

You might also clarify what a vsam/PS is. This is not a term i've seen before.

VSAM files are not PS and PS files are not VSAM.
Last edited by DikDude on Sat Oct 12, 2013 12:11 am, edited 1 time in total.
Have a good one

Sun
Member
Posts: 2
Joined: Thu Oct 10, 2013 4:24 pm

Post by Sun » Fri Oct 11, 2013 7:48 am

Hi All,,

Thanks for all the response.

Here you go with the right requirement

Some new records needs to be inserted in to VSAM file(ksds) which is already existing. I need it to do through JCL using the sort utility.

William Collins
Active Member
Posts: 732
Joined: Thu May 24, 2012 4:07 am

Post by William Collins » Fri Oct 11, 2013 11:43 am

Where are they inserted from? Do they need to be reformatted? How many records?

Is SORT the appropriate tool? SORT is generally reading an entire dataset, doing some processing, and writing an entire dataset. Having you tried using SORT to insert keys in a KSDS? Have you found it in the manuals?

DikDude
Moderator
Posts: 1001
Joined: Fri Jul 22, 2011 8:39 am
Location: usa

Post by DikDude » Sat Oct 12, 2013 12:13 am

How large is the existing vsam file (#records)?

Consider unloading the vsam file and making all of the changs to the sequential data. Once all changes are done, reload inito the vsam file.

This can all be done using sort.
Have a good one

Post Reply

FREE TUTORIALS

Tutorials
Free tutorials from mainframegurukul
  • JCL Tutorial
    Covers all important JCL concepts.
  • Cobol Tutorial
    This tutorials covers all Cobol Topics from STRING to COMP-3.
  • DB2 Tutorial
    DB2 Tutorial focuses on DB2 COBOL Programming.
  • SORT Tutorial
    This Tutorial covers all important aspects of DFSORT with examples
  • CICS Tutorial
    This CICS tutorial covers CICS concepts and CICS Basics, CICS COBOL Programming.
Interview
Mainframe Interview questions



Other References
Mainframe Tools and others