View previous topic :: View next topic
|
Author |
Message |
MSTP
New User
Joined: 21 Jun 2007 Posts: 30 Location: Baltimore
|
|
|
|
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 |
|
|
Terry Heinze
JCL Moderator
Joined: 14 Jul 2008 Posts: 1249 Location: Richfield, MN, USA
|
|
|
|
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 |
|
|
Robert Sample
Global Moderator
Joined: 06 Jun 2008 Posts: 8697 Location: Dubuque, Iowa, USA
|
|
|
|
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 |
|
|
Frank Yaeger
DFSORT Developer
Joined: 15 Feb 2005 Posts: 7129 Location: San Jose, CA
|
|
|
|
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 |
|
|
MSTP
New User
Joined: 21 Jun 2007 Posts: 30 Location: Baltimore
|
|
|
|
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 |
|
|
dneufarth
Active User
Joined: 27 Apr 2005 Posts: 420 Location: Inside the SPEW (Southwest Ohio, USA)
|
|
|
|
a classroom exercise? |
|
Back to top |
|
|
dick scherrer
Moderator Emeritus
Joined: 23 Nov 2006 Posts: 19244 Location: Inside the Matrix
|
|
|
|
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 |
|
|
Frank Yaeger
DFSORT Developer
Joined: 15 Feb 2005 Posts: 7129 Location: San Jose, CA
|
|
|
|
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 |
|
|
MSTP
New User
Joined: 21 Jun 2007 Posts: 30 Location: Baltimore
|
|
|
|
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 |
|
|
|