Portal | Manuals | References | Downloads | Info | Programs | JCLs | Master the Mainframes
IBM Mainframe Computers Forums Index
 
Register
 
IBM Mainframe Computers Forums Index Mainframe: Search IBM Mainframe Forum: FAQ Memberlist Usergroups Profile Log in to check your private messages Log in
 

 

Include text between records
Goto page 1, 2  Next
 
Post new topic   Reply to topic    IBMMAINFRAMES.com Support Forums -> DFSORT/ICETOOL
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    Post subject: Include text between records
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: 1703
Location: Australia

PostPosted: Sun May 31, 2009 10:56 am    Post subject:
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    Post subject: Reply to: Include text between records
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: 1703
Location: Australia

PostPosted: Sun May 31, 2009 2:38 pm    Post subject:
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 Moderator


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

PostPosted: Sun May 31, 2009 10:36 pm    Post subject:
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: 1703
Location: Australia

PostPosted: Mon Jun 01, 2009 3:37 am    Post subject:
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 Moderator


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

PostPosted: Mon Jun 01, 2009 8:39 pm    Post subject:
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: 1703
Location: Australia

PostPosted: Tue Jun 02, 2009 3:40 am    Post subject:
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 Moderator


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

PostPosted: Tue Jun 02, 2009 4:30 am    Post subject:
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    Post subject:
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    Post subject: Reply to: Include text between records
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    Post subject:
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    Post subject:
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    Post subject:
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    Post subject: Reply to: Include text between records
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    Post subject: Reply to: Include text between records
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    Post subject:
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    Post subject: Reply to: Include text between records
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    Post subject: Reply to: Include text between records
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    Post subject:
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
View previous topic :: :: View next topic  
Post new topic   Reply to topic    IBMMAINFRAMES.com Support Forums -> DFSORT/ICETOOL All times are GMT + 6 Hours
Goto page 1, 2  Next
Page 1 of 2

 

Search our Forum:

Similar Topics
Topic Author Forum Replies Posted
No new posts Limit duplicate records in the SORT pshongal SYNCSORT 6 Mon Nov 21, 2016 12:54 pm
No new posts How to update a portion of text in a ... Bill Woodger DFSORT/ICETOOL 25 Wed Nov 09, 2016 9:41 pm
This topic is locked: you cannot edit posts or make replies. How to pass the previous month date i... Suganya87 DFSORT/ICETOOL 5 Mon Oct 31, 2016 4:13 pm
No new posts How to split the records using the am... vnktrrd DFSORT/ICETOOL 24 Fri Oct 28, 2016 7:33 pm
No new posts Sort records based on numeric field. Alks SYNCSORT 2 Wed Oct 19, 2016 10:14 pm


Facebook
Back to Top
 
Mainframe Wiki | Forum Rules | Bookmarks | Subscriptions | FAQ | Tutorials | Contact Us