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

Include text between records


IBM Mainframe Forums -> DFSORT/ICETOOL
Post new topic   Reply to topic
View previous topic :: View next topic  
Author Message
sumitmalik29
Warnings : 1

New User


Joined: 10 Feb 2008
Posts: 19
Location: bhuneswar

PostPosted: Sat May 30, 2009 6:04 pm
Reply with quote

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
View user's profile Send private message
gcicchet

Senior Member


Joined: 28 Jul 2006
Posts: 1702
Location: Australia

PostPosted: Sun May 31, 2009 10:56 am
Reply with quote

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
View user's profile Send private message
sumitmalik29
Warnings : 1

New User


Joined: 10 Feb 2008
Posts: 19
Location: bhuneswar

PostPosted: Sun May 31, 2009 1:25 pm
Reply with quote

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
View user's profile Send private message
gcicchet

Senior Member


Joined: 28 Jul 2006
Posts: 1702
Location: Australia

PostPosted: Sun May 31, 2009 2:38 pm
Reply with quote

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
View user's profile Send private message
Frank Yaeger

DFSORT Developer


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

PostPosted: Sun May 31, 2009 10:36 pm
Reply with quote

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
View user's profile Send private message
gcicchet

Senior Member


Joined: 28 Jul 2006
Posts: 1702
Location: Australia

PostPosted: Mon Jun 01, 2009 3:37 am
Reply with quote

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
View user's profile Send private message
Frank Yaeger

DFSORT Developer


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

PostPosted: Mon Jun 01, 2009 8:39 pm
Reply with quote

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
View user's profile Send private message
gcicchet

Senior Member


Joined: 28 Jul 2006
Posts: 1702
Location: Australia

PostPosted: Tue Jun 02, 2009 3:40 am
Reply with quote

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. icon_smile.gif


Gerry
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: Tue Jun 02, 2009 4:30 am
Reply with quote

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
View user's profile Send private message
malayajena

New User


Joined: 08 Jul 2006
Posts: 28
Location: Singapore

PostPosted: Tue Jun 09, 2009 6:50 pm
Reply with quote

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
View user's profile Send private message
Escapa

Senior Member


Joined: 16 Feb 2007
Posts: 1399
Location: IL, USA

PostPosted: Tue Jun 09, 2009 7:47 pm
Reply with quote

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
View user's profile Send private message
malayajena

New User


Joined: 08 Jul 2006
Posts: 28
Location: Singapore

PostPosted: Tue Jun 09, 2009 8:23 pm
Reply with quote

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
View user's profile Send private message
Skolusu

Senior Member


Joined: 07 Dec 2007
Posts: 2205
Location: San Jose

PostPosted: Tue Jun 09, 2009 8:54 pm
Reply with quote

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
View user's profile Send private message
malayajena

New User


Joined: 08 Jul 2006
Posts: 28
Location: Singapore

PostPosted: Wed Jun 10, 2009 1:21 pm
Reply with quote

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
View user's profile Send private message
Skolusu

Senior Member


Joined: 07 Dec 2007
Posts: 2205
Location: San Jose

PostPosted: Wed Jun 10, 2009 10:31 pm
Reply with quote

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
View user's profile Send private message
malayajena

New User


Joined: 08 Jul 2006
Posts: 28
Location: Singapore

PostPosted: Wed Jun 10, 2009 10:46 pm
Reply with quote

Hi Skolusu

Will try this and let you know as me not in Office now.

Thanks for replying.
Back to top
View user's profile Send private message
malayajena

New User


Joined: 08 Jul 2006
Posts: 28
Location: Singapore

PostPosted: Fri Jun 12, 2009 3:45 pm
Reply with quote

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
View user's profile Send private message
Skolusu

Senior Member


Joined: 07 Dec 2007
Posts: 2205
Location: San Jose

PostPosted: Sat Jun 13, 2009 1:22 am
Reply with quote

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
View user's profile Send private message
malayajena

New User


Joined: 08 Jul 2006
Posts: 28
Location: Singapore

PostPosted: Sun Jun 14, 2009 8:19 pm
Reply with quote

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
View user's profile Send private message
Skolusu

Senior Member


Joined: 07 Dec 2007
Posts: 2205
Location: San Jose

PostPosted: Mon Jun 15, 2009 10:11 pm
Reply with quote

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
View user's profile Send private message
malayajena

New User


Joined: 08 Jul 2006
Posts: 28
Location: Singapore

PostPosted: Tue Jun 16, 2009 8:31 pm
Reply with quote

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
View user's profile Send private message
Skolusu

Senior Member


Joined: 07 Dec 2007
Posts: 2205
Location: San Jose

PostPosted: Tue Jun 16, 2009 9:01 pm
Reply with quote

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
View user's profile Send private message
malayajena

New User


Joined: 08 Jul 2006
Posts: 28
Location: Singapore

PostPosted: Wed Jun 17, 2009 5:56 pm
Reply with quote

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
View user's profile Send private message
enrico-sorichetti

Superior Member


Joined: 14 Mar 2007
Posts: 10873
Location: italy

PostPosted: Wed Jun 17, 2009 6:19 pm
Reply with quote

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 icon_evil.gif

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
View user's profile Send private message
malayajena

New User


Joined: 08 Jul 2006
Posts: 28
Location: Singapore

PostPosted: Wed Jun 17, 2009 7:12 pm
Reply with quote

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
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 -> DFSORT/ICETOOL Goto page 1, 2  Next

 


Similar Topics
Topic Forum Replies
No new posts Compare 2 files(F1 & F2) and writ... JCL & VSAM 8
No new posts INCLUDE OMIT COND for Multiple values... DFSORT/ICETOOL 5
No new posts Compare only first records of the fil... SYNCSORT 7
No new posts Pulling a fixed number of records fro... DB2 2
No new posts Join multiple records using splice DFSORT/ICETOOL 5
Search our Forums:

Back to Top