View previous topic :: View next topic
|
Author |
Message |
sumitmalik29 Warnings : 1 New User
Joined: 10 Feb 2008 Posts: 19 Location: bhuneswar
|
|
|
|
i want to include heading for my recoreds, say
after every 4 records, at headings too
for example input recoreds are
1234 7888 4567
1675 7675 4598
1923 7364 4555
3455 4554 7878
4565 6578 8904
3546 4933 9098
5437 8990 7934
6834 9283 9729
can we have a output like
S2A1 S2A2 S2A3
1234 7888 4567
1675 7675 4598
1923 7364 4555
S2A1 S2A2 S2A3
3455 4554 7878
4565 6578 8904
3546 4933 9098
5437 8990 7934
S2A1 S2A2 S2A3
6834 9283 9729
Thanks in advance |
|
Back to top |
|
|
gcicchet
Senior Member
Joined: 28 Jul 2006 Posts: 1702 Location: Australia
|
|
|
|
Hi,
are you sure your output is correct ?
Code: |
S2A1 S2A2 S2A3
1234 7888 4567
1675 7675 4598
1923 7364 4555
S2A1 S2A2 S2A3 ? after 3 records
3455 4554 7878
4565 6578 8904
3546 4933 9098
5437 8990 7934
S2A1 S2A2 S2A3
6834 9283 9729
|
Gerry |
|
Back to top |
|
|
sumitmalik29 Warnings : 1 New User
Joined: 10 Feb 2008 Posts: 19 Location: bhuneswar
|
|
|
|
hi
sorry , i missed one record in between.
my requirement is "text to be included after every 4 records"
S2A1 S2A2 S2A3
1234 7888 4567
1675 7675 4598
1923 7364 4555
3457 6879 6809
S2A1 S2A2 S2A3 > after every 4 records
3455 4554 7878
4565 6578 8904
3546 4933 9098
5437 8990 7934
S2A1 S2A2 S2A3
6834 9283 9729
Thanks |
|
Back to top |
|
|
gcicchet
Senior Member
Joined: 28 Jul 2006 Posts: 1702 Location: Australia
|
|
|
|
Hi,
try this
Code: |
//STEP0001 EXEC PGM=ICEMAN
//SYSOUT DD SYSOUT=*
//SORTIN DD *
1234 7888 4567
2675 7675 4598
3923 7364 4555
4455 4554 7878
5565 6578 8904
6546 4933 9098
7437 8990 7934
8834 9283 9729
//SORTOUT DD SYSOUT=*
//SYSIN DD *
OPTION COPY
OUTFIL IFOUTLEN=080,REMOVECC,
HEADER1=('S2A1 S2A2 S2A3'),
IFTHEN=(WHEN=INIT,
OVERLAY=(081:SEQNUM,8,ZD,START=1,
089:081,8,ZD,MOD,+04,TO=ZD,LENGTH=2)),
IFTHEN=(WHEN=(089,2,ZD,EQ,+00),
/*
|
Gerry |
|
Back to top |
|
|
Frank Yaeger
DFSORT Developer
Joined: 15 Feb 2005 Posts: 7129 Location: San Jose, CA
|
|
|
|
Gerry,
I'm not sure what you're trying to do but you seem to be missing some control statements and your solution is more complicated than it has to be.
Sumit,
Here's a DFSORT job that will do what you asked for:
Code: |
//S1 EXEC PGM=ICEMAN
//SYSOUT DD SYSOUT=*
//SORTIN DD DSN=... input file
//SORTOUT DD DSN=... output file
//SYSIN DD *
OPTION COPY
OUTFIL REMOVECC,LINES=5,
HEADER2=('S2A1 S2A2 S2A3')
/*
|
|
|
Back to top |
|
|
gcicchet
Senior Member
Joined: 28 Jul 2006 Posts: 1702 Location: Australia
|
|
|
|
Hi Frank,
yes I did miss 1 line, it should have been
Code: |
OPTION COPY
OUTFIL IFOUTLEN=080,REMOVECC,
HEADER1=('S2A1 S2A2 S2A3'),
IFTHEN=(WHEN=INIT,
OVERLAY=(081:SEQNUM,8,ZD,START=1,
089:081,8,ZD,MOD,+04,TO=ZD,LENGTH=2)),
IFTHEN=(WHEN=(089,2,ZD,EQ,+00),
BUILD=(1,080,/1:C'S2A1 S2A2 S2A3'))
|
Also mine will add the header after every 4 records, ie
Code: |
S2A1 S2A2 S2A3
1234 7888 4567
2675 7675 4598
3923 7364 4555
4455 4554 7878
S2A1 S2A2 S2A3
5565 6578 8904
6546 4933 9098
7437 8990 7934
8834 9283 9729
S2A1 S2A2 S2A3
|
Maybe I misunderstood the question
Quote: |
i want to include heading for my recoreds, say
after every 4 records, at headings too
|
Gerry |
|
Back to top |
|
|
Frank Yaeger
DFSORT Developer
Joined: 15 Feb 2005 Posts: 7129 Location: San Jose, CA
|
|
|
|
Quote: |
Also mine will add the header after every 4 records |
My solution does too (both solutions produce the same output). But looking at the two, which looks simpler to you?
|
|
Back to top |
|
|
gcicchet
Senior Member
Joined: 28 Jul 2006 Posts: 1702 Location: Australia
|
|
|
|
Hi Frank,
my solution generates 11 lines of output, your solution generates 10 lines of output.
My logic was to place a header followed by 4 records followed by another header ie. if only 4 records resided on the input file my result would be Header + 4 records + Header, but as I stated earlier, maybe I misunderstood the question.
Quote: |
But looking at the two, which looks simpler to you?
|
No arguments there.
Gerry |
|
Back to top |
|
|
Frank Yaeger
DFSORT Developer
Joined: 15 Feb 2005 Posts: 7129 Location: San Jose, CA
|
|
|
|
I was using one more input line for my testing which gives the same output for both solutions. You're right that with only 8 lines, you have an extra header at the end. I'm not sure why that would be needed.
Maybe the confusion is that the original OP's input and output didn't really match. I took the requirement as having a header after every 4 records so if the input was:
Code: |
1234 7888 4567
1675 7675 4598
1923 7364 4555
3455 4554 7878
4565 6578 8904
3546 4933 9098
5437 8990 7934
6834 9283 9729
|
The output would be:
Code: |
S2A1 S2A2 S2A3
1234 7888 4567
1675 7675 4598
1923 7364 4555
3455 4554 7878
S2A1 S2A2 S2A3
4565 6578 8904
3546 4933 9098
5437 8990 7934
6834 9283 9729
|
That's what my solution produces for output. |
|
Back to top |
|
|
malayajena
New User
Joined: 08 Jul 2006 Posts: 28 Location: Singapore
|
|
|
|
HI Frank
In addition to this can we include more than one line after certain no. of records.
Lets say :
1234 7888 4567
1675 7675 4598
1923 7364 4555
3455 4554 7878
S2A1 S2A2 S2A3
S2B1 S2B2 S2B3 ...like this. |
|
Back to top |
|
|
Escapa
Senior Member
Joined: 16 Feb 2007 Posts: 1399 Location: IL, USA
|
|
|
|
malayajena wrote: |
can we include more than one line after certain no. of records.
|
Just change like this...
Code: |
//SYSIN DD *
OPTION COPY
OUTFIL REMOVECC,LINES=5,
HEADER2=('S2A1 S2A2 S2A3',/,'S2B1 S2B2 S2B3')
/*
|
|
|
Back to top |
|
|
malayajena
New User
Joined: 08 Jul 2006 Posts: 28 Location: Singapore
|
|
|
|
Hi Sambhaji, thanks for this.Its working.
For all,
I have another requirement also. If we want to control the display part after certain no. of lines.here it is static. i.e. S2A1 S2A2 S2A3 .And this JCL inputs this record from the start to the end of the file at given regular intervals.
But if we want to introduce different displays after 4th line, 8th line, 12th line etc. Can this also be controlled by JCL?
Appreciate your valuable comment on this. |
|
Back to top |
|
|
Skolusu
Senior Member
Joined: 07 Dec 2007 Posts: 2205 Location: San Jose
|
|
|
|
malayajena,
You need to show a sample of what you want. what happens if there are 10 millions records ? Are you going to have 250,000 variations of headers? |
|
Back to top |
|
|
malayajena
New User
Joined: 08 Jul 2006 Posts: 28 Location: Singapore
|
|
|
|
Ok,here is the details.
I have 960 records.I want to insert different headers at 40th,80th,120th likewise records.
Input is like:
000040 **** - END OF PROGRAM - RETURN-CODE 0000000000 - ****
000080 **** - END OF PROGRAM - RETURN-CODE 0000000000 - ****
000120 **** - END OF PROGRAM - RETURN-CODE 0000000000 - ****
Output should be :
000040 **** - Header 1- ****
000041 **** - END OF PROGRAM - RETURN-CODE 0000000000 - ****
000080 **** - Header2 - ****
000081 **** - END OF PROGRAM - RETURN-CODE 0000000000 - ****
000120 **** - header3 - ****
000121 **** - END OF PROGRAM - RETURN-CODE 0000000000 - ****
Hope this gives an idea about my requirement. |
|
Back to top |
|
|
Skolusu
Senior Member
Joined: 07 Dec 2007 Posts: 2205 Location: San Jose
|
|
|
|
Use these control cards
Code: |
//SYSIN DD *
OPTION COPY
INREC OVERLAY=(81:SEQNUM,8,ZD,START=41,
81,8,ZD,MOD,+40,TO=ZD,LENGTH=2)
OUTFIL IFOUTLEN=80,
IFTHEN=(WHEN=(89,2,ZD,EQ,0),
BUILD=(81,8,ZD,SUB,+40,M11,LENGTH=8,X,
C'*** - HEADER ',+1,SUB,(81,8,ZD,DIV,+40),M10,LENGTH=8,
C'- ****',/,1,80))
|
|
|
Back to top |
|
|
malayajena
New User
Joined: 08 Jul 2006 Posts: 28 Location: Singapore
|
|
|
|
Hi Skolusu
Will try this and let you know as me not in Office now.
Thanks for replying. |
|
Back to top |
|
|
malayajena
New User
Joined: 08 Jul 2006 Posts: 28 Location: Singapore
|
|
|
|
Hi , thanks again and sorry for the delayed response.
this works great, but still my idea is mistaken and this doesn't have the flexibility what i was looking for. Need to clarify....
The header which i am talking about is changeble.
That means if after 40th record its 'header 1' then after 80th record it could be 'ABCDEF' depending on my requirement.
so here we go..
Input is like:
000040 **** - END OF PROGRAM - RETURN-CODE 0000000000 - ****
000080 **** - END OF PROGRAM - RETURN-CODE 0000000000 - ****
000120 **** - END OF PROGRAM - RETURN-CODE 0000000000 - ****
Output should be :
000040 **** - Header 1- ****
000041 **** - END OF PROGRAM - RETURN-CODE 0000000000 - ****
000080 **** - ABCDEF ****
000081 **** - END OF PROGRAM - RETURN-CODE 0000000000 - ****
000120 **** - GHIJKL ****
000121 **** - END OF PROGRAM - RETURN-CODE 0000000000 - ****
Hope this doesn't make it an impossible requirement. |
|
Back to top |
|
|
Skolusu
Senior Member
Joined: 07 Dec 2007 Posts: 2205 Location: San Jose
|
|
|
|
malayajena wrote: |
The header which i am talking about is changeble.
That means if after 40th record its 'header 1' then after 80th record it could be 'ABCDEF' depending on my requirement. |
malayajena,
My crystal ball isn't working today. You need to do a better job of explaining "your so called requirements." where do you plan to get the values ABCDEF , GHIJKL ? Are these values anywhere in the record? or you want a random string? If it is indeed a random string , what happens if the input has 10 millions of records? Are you going to have 250k of random strings? |
|
Back to top |
|
|
malayajena
New User
Joined: 08 Jul 2006 Posts: 28 Location: Singapore
|
|
|
|
Hello,
These headers are fixed but have different texts. That means Header@40th row will always show "ABCDEF",header@80th row will always show "DEFGHU" and header@120th row will always show "fgghji" like that i have around 900 records and will need 24 such headers.
Hope its clear.Sorry for the delayed response and let me know if you require any more info. |
|
Back to top |
|
|
Skolusu
Senior Member
Joined: 07 Dec 2007 Posts: 2205 Location: San Jose
|
|
|
|
malayajena wrote: |
Hope its clear.Sorry for the delayed response and let me know if you require any more info. |
NO it is not clear . I get the point that you need to change the header value for every 40th record, but you never answered the question of as to where I would get those values. once again read my prior post clearly and answer all my questions |
|
Back to top |
|
|
malayajena
New User
Joined: 08 Jul 2006 Posts: 28 Location: Singapore
|
|
|
|
hi Kolusu
Header values are different texts but we know exactly what are these values after every 40th record.So the point is if you can show me how to insert those variable headers in 40th,80th,120th etc records then i can amend it according to my requirement and insert the proper headers. I have 24 such headers which comes after every 40th record. Now, let me know if this seems a feasible Job which can be done through JCl. Appreciate your help so far and let me know if you have any more concerns. |
|
Back to top |
|
|
Skolusu
Senior Member
Joined: 07 Dec 2007 Posts: 2205 Location: San Jose
|
|
|
|
malayajena,
*Sigh* This is worse than a dentist trying to pull a tooth. What part of this did you not understand?
skolusu wrote: |
where do you plan to get the values ABCDEF , GHIJKL ?Are these values anywhere in the record? or you want a random string? If it is indeed a random string , what happens if the input has 10 millions of records? Are you going to have 250k of random strings? |
malayajena wrote: |
Now, let me know if this seems a feasible Job which can be done through JCl. |
For the record JCL canNOT do anything. It is your programs and utilities which can get you the desired results. JCL does not do anything other than establish an environment in which the STEPs of the JOB can execute. |
|
Back to top |
|
|
malayajena
New User
Joined: 08 Jul 2006 Posts: 28 Location: Singapore
|
|
|
|
Alright, then better we rest this requirement.Thanks for your valubale time.
Really appreciate it but simultaneously little dissapointed too bacause of the unclear air stil there:) and i couldn't help you understand it. |
|
Back to top |
|
|
enrico-sorichetti
Superior Member
Joined: 14 Mar 2007 Posts: 10873 Location: italy
|
|
|
|
Quote: |
Really appreciate it but simultaneously little dissapointed too bacause of the unclear air stil there:) and i couldn't help you understand it. |
You should be disappointed toward Yourself, Not Kolusu or anybody' s else fault ...
You simply were not able to understand the clarification questions posed
or rather not able or not willing to explain
in the sample/solution posted the line/record/header/trailer/<call it in any f* name You want> to be inserted was hardcoded in the sort control statements
Kolusu , in order to give maximum flexibility to his solution for the new requirement
I.E.
not having the strings hardcoded in the sort control statements
was asking how You wanted to provide the line/record/header/trailer/<call it in any f* name You want>
I.E.
if they were somehow part of the input file,
or You were planning of providing them as an additional file to be fed as additional input to sort |
|
Back to top |
|
|
malayajena
New User
Joined: 08 Jul 2006 Posts: 28 Location: Singapore
|
|
|
|
I think i will look for an alternative to this as i am also not sure how i will be able to make you guys understand. So sorry again for making you guys spend time on this so far.
Thanks and Regards. |
|
Back to top |
|
|
|