IBM Mainframe Forum Index
 
Log In
 
IBM Mainframe Forum Index Mainframe: Search IBM Mainframe Forum: FAQ Register
 

Add 2 new rows at the end of file


IBM Mainframe Forums -> JCL & VSAM
Post new topic   Reply to topic
View previous topic :: View next topic  
Author Message
MSTP

New User


Joined: 21 Jun 2007
Posts: 30
Location: Baltimore

PostPosted: Wed Apr 28, 2010 3:32 am
Reply with quote

I need to add 2 new rows at the end of file at position 1 with the below file values
row 1 --> NEXT-PROCESSING-MONTH
row 2 --> AGENCY-CODE-USED

How can this be done using sort.

thanks
mstp
Back to top
View user's profile Send private message
Terry Heinze

JCL Moderator


Joined: 14 Jul 2008
Posts: 1249
Location: Richfield, MN, USA

PostPosted: Wed Apr 28, 2010 4:23 am
Reply with quote

Do you mean records, not rows? Are you talking about a file, not a data base table? Please be more specific about your requirement.
Back to top
View user's profile Send private message
Robert Sample

Global Moderator


Joined: 06 Jun 2008
Posts: 8697
Location: Dubuque, Iowa, USA

PostPosted: Wed Apr 28, 2010 4:32 am
Reply with quote

Terminology is critical in IT, where similar sounding terms mean very different things. Files do not have rows, so you cannot add rows to the end of a file. Files have records, while data bases have rows. as Terry alluded. Since you have confused a very basic term, we cannot answer your question.

If you really want to add rows to a file, the answer is that it cannot be done. Period. If you mean to add records to the end of a file, or rows to the end of a data base, you have not provided anywhere near enough information for a realistic answer. In the first case, what is the file record length? Are the records fixed length or variable length? If you're wanting to add rows to a data base, are you talking Oracle? IDMS? DB2? IMS? Some other data base?
Back to top
View user's profile Send private message
Frank Yaeger

DFSORT Developer


Joined: 15 Feb 2005
Posts: 7129
Location: San Jose, CA

PostPosted: Wed Apr 28, 2010 4:57 am
Reply with quote

MSTP,

Assuming you have an input file and you want to add records with DFSORT, please show an example of your input records and what you expect for output. Explain the "rules" for getting from input to output. Give the RECFM and LRECL of your input file.
Back to top
View user's profile Send private message
MSTP

New User


Joined: 21 Jun 2007
Posts: 30
Location: Baltimore

PostPosted: Wed Apr 28, 2010 8:30 pm
Reply with quote

I do have a input file of RECFM=F,LRECL=40 which has 5 records and the requirements is to copy 2 new records to the input file at the end of the file as 6th and 7th and copy them in the output file.
INPUT

CURRENT-MONTH
PREV-PROCESSING-MONTH
UPDATE-VALUES
TABLE-VALUES
METHOD-TODO


OUTPUT


CURRENT-MONTH
PREV-PROCESSING-MONTH
UPDATE-VALUES
TABLE-VALUES
METHOD-TODO
NEXT-PROCESSING-MONTH
AGENCY-CODE-USED
Back to top
View user's profile Send private message
dneufarth

Active User


Joined: 27 Apr 2005
Posts: 420
Location: Inside the SPEW (Southwest Ohio, USA)

PostPosted: Wed Apr 28, 2010 9:36 pm
Reply with quote

a classroom exercise?
Back to top
View user's profile Send private message
dick scherrer

Moderator Emeritus


Joined: 23 Nov 2006
Posts: 19244
Location: Inside the Matrix

PostPosted: Wed Apr 28, 2010 10:06 pm
Reply with quote

Hello,

So, type the 2 new records into another file with the same dcb attributes and then concatenate them into a copy. Or simply edit the original file.

You need to provide a more complete explanation of the "requirement" and not build it up piece by piece. As posted there is no business requirement that this would support. . .
Back to top
View user's profile Send private message
Frank Yaeger

DFSORT Developer


Joined: 15 Feb 2005
Posts: 7129
Location: San Jose, CA

PostPosted: Wed Apr 28, 2010 10:52 pm
Reply with quote

mstp,

You can use a DFSORT job like the following to do what you asked for:

Code:

//S1 EXEC PGM=SORT
//SYSOUT DD SYSOUT=*
//SORTIN DD DSN=...  input file (FB/40)
//SORTOUT DD DSN=...  output file (FB/40)
//SYSIN DD *
   OPTION COPY
   OUTFIL REMOVECC,
     TRAILER1=('NEXT-PROCESSING-MONTH',/,
       'AGENCY-CODE-USED')
/*
Back to top
View user's profile Send private message
MSTP

New User


Joined: 21 Jun 2007
Posts: 30
Location: Baltimore

PostPosted: Mon May 03, 2010 10:46 pm
Reply with quote

thanks for the response I used dick scherrer suggestion on adding 2 new records into another new file and then concat them using copy.
Back to top
View user's profile Send private message
View previous topic :: :: View next topic  
Post new topic   Reply to topic View Bookmarks
All times are GMT + 6 Hours
Forum Index -> JCL & VSAM

 


Similar Topics
Topic Forum Replies
No new posts Compare 2 files and retrive records f... DFSORT/ICETOOL 3
No new posts FTP VB File from Mainframe retaining ... JCL & VSAM 8
No new posts Extract the file name from another fi... DFSORT/ICETOOL 6
No new posts How to split large record length file... DFSORT/ICETOOL 10
No new posts Extracting Variable decimal numbers f... DFSORT/ICETOOL 17
Search our Forums:

Back to Top