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
 

 

Holding a record in memory...

 
Post new topic   Reply to topic    IBMMAINFRAMES.com Support Forums -> DFSORT/ICETOOL
View previous topic :: :: View next topic  
Author Message
yianis

New User


Joined: 14 Aug 2006
Posts: 45

PostPosted: Thu Oct 12, 2006 5:57 pm    Post subject: Holding a record in memory...
Reply with quote

Hi,

I have a file:

A
100
A
050
B
300
A
100
B
250


etc...

In other words, I have a file with a record type in column 1 (i.e. 'A' or 'B' or whatever) and in the following record a numeric value (i.e. 100).
I want to eventually sum fields by record type the numeric value that follows it.

The output should be like this:
A250
B550

Also, is there a way of reading a file and holding a record in memory while you search the file for another record?
Example:

Input FIle:

1111111111
123456789A<--- record with 'A' in column 10
1111111111
123456789B
1111111111
123456789C
99XXX10000<---- record with '99' in column 1 and take 10000 value
.
.
.

Let's say I need to look for an 'A' in column 10 and then keep searching for the next '99' in column 1 and take the value in column 6 (5 bytes), therefore my output file would be:
A10000
.
.
.
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: Thu Oct 12, 2006 9:52 pm    Post subject:
Reply with quote

Here's a DFSORT/ICETOOL job that will do the first thing you asked for. You'll need z/OS DFSORT V1R5 PTF UK90007 or DFSORT R14 PTF UK90006 (April, 2006) to use INREC with SPLICE. If you don't have that PTF, ask your System Programmer to install it. Alternatively, you could use an extra COPY operator before the SPLICE operator to do the INREC. Without the April, 2006 PTF, you won't get any output.

Code:

//S1 EXEC PGM=ICETOOL
//TOOLMSG DD SYSOUT=*
//DFSMSG DD SYSOUT=*
//IN DD *
A
100
A
050
B
300
A
100
B
250
/*
//T1 DD DSN=&&T1,UNIT=SYSDA,SPACE=(CYL,(5,5)),DISP=(,PASS)
//OUT DD SYSOUT=*
//TOOLIN DD *
SPLICE FROM(IN) TO(T1) ON(81,8,ZD) WITH(2,3) USING(CTL1)
SORT FROM(T1) TO(OUT) USING(CTL2)
/*
//CTL1CNTL DD *
  INREC IFTHEN=(WHEN=INIT,
          OVERLAY=(81:SEQNUM,1,ZD,START=0,INCR=5)),
        IFTHEN=(WHEN=(81,1,ZD,EQ,+0),
          OVERLAY=(81:SEQNUM,8,ZD)),
        IFTHEN=(WHEN=(81,1,ZD,EQ,+5),
          BUILD=(2:1,3,81:SEQNUM,8,ZD))
/*
//CTL2CNTL DD *
  SORT FIELDS=(1,1,CH,A)
  OPTION ZDPRINT
  SUM FIELDS=(2,3,ZD)
  OUTREC BUILD=(1,80)
/*
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: Thu Oct 12, 2006 9:55 pm    Post subject:
Reply with quote

For your second requirement, are you just looking for one 'A' and '99' pair or multiple 'A' and '99' pairs, or different pairs or what?

Please show an example of your input records and expected output with more variations if you have more.
Back to top
View user's profile Send private message
yianis

New User


Joined: 14 Aug 2006
Posts: 45

PostPosted: Thu Oct 12, 2006 11:11 pm    Post subject:
Reply with quote

First as always, your assistance is much appreciated and Thank You !!!!

As for the 2nd example:

The input file contains in sequence the following:

1111111111
123456789A<--- record with 'A' in column 10
1111111111
123456789B
1111111111
123456789C
99XXX10000<---- record with '99' in column 1 and take 10000 value
1111111111
123456789B<--- record with 'B' in column 10
1111111111
123456789B
1111111111
123456789C
99XXX10000<---- record with '99' in column 1 and take 10000 value
1111111111
123456789A<--- record with 'A' in column 10
1111111111
123456789B
1111111111
123456789C
99XXX10000<---- record with '99' in column 1 and take 10000 value

In other words, the file contains a record type in column 10 (1 character byte) and somewhere down the file, there is a '99' record type in column 1 in sequence and that's what I want to pair it up with. This process repeats itself in the file...

The output would be:
A10000
B10000
A10000

Thanks
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: Fri Oct 13, 2006 12:54 am    Post subject:
Reply with quote

Quote:
the file contains a record type in column 10 (1 character byte)


Please give the complete list of record types you want to look for.

You show:

Code:

1111111111
123456789A<--- record with 'A' in column 10
1111111111
123456789B
1111111111
123456789C
99XXX10000<---- record with '99' in column 1 and take 10000 value



I see records with 'A', 'B' and 'C' in column 10 before the '99' record. Are you looking for the first 'A' or 'B' (or other?) record and then the next '99' record, and then the next 'A' or 'B' (or other?) record and then the next '99' record, etc?
Back to top
View user's profile Send private message
yianis

New User


Joined: 14 Aug 2006
Posts: 45

PostPosted: Fri Oct 13, 2006 8:34 am    Post subject:
Reply with quote

Hi Frank,

Sorry, but my sample data was made up and is not clear..
Look at it this way..
Code:
1111111111
103456789C<--- record type with '10' in column 01 (2bytes)
1111111111
1234567891
1111111111
1234567891
99XXX10000<---- record with '99' in column 1 and take 10000 value
1111111111
103456789B<--- record type with '10' in column 01 (2bytes)
1111111111
1234567891
1111111111
1234567891
99XXX10000<---- record with '99' in column 1 and take 10000 value
1111111111
103456789C<--- record type with '10' in column 01 (2bytes)
1111111111
1234567891
1111111111
1234567891
99XXX10000<---- record with '99' in column 1 and take 10000 value 
etc...



In column 1 for 2 bytes is the Record Type.
There will be a record type = '10' and I need to extract the 1 byte character on that line (i.e. 'C'), then I need to look for the next Record Type = '99' and get the numeric value (i.e. 10000). Now I need to keep reading the file, as there will be another set of data with the record type of '10' followed further down by a record tpye of '99', etc...
therfore at the end the output shoould look like this:
C10000
B10000
C10000
I don't really need the record types in the output.
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: Fri Oct 13, 2006 8:28 pm    Post subject:
Reply with quote

Here's a DFSORT/ICETOOL job that will do what you asked for. You'll need z/OS DFSORT V1R5 PTF UK90007 or DFSORT R14 PTF UK90006 (April, 2006) in order to use INREC with SPLICE. If you don't have the April, 2006 PTF, ask your System Programmer to install it (it's free). For complete details on all of the new DFSORT and ICETOOL functions available with the April, 2006 PTF, see:

www.ibm.com/servers/storage/support/software/sort/mvs/peug/


If you don't have the April, 2006 PTF, you won't get any output records. Alternatively, you could use a separate COPY operator with the INCLUDE and INREC statements before the SPLICE operator.

Code:

//S1 EXEC PGM=ICETOOL
//TOOLMSG DD SYSOUT=*
//DFSMSG DD SYSOUT=*
//IN DD DSN=...  input file (FB/10)
//OUT DD DSN=...  output file (FB/10)
//TOOLIN DD *
SPLICE FROM(IN) TO(OUT) ON(11,8,ZD) -
 WITH(2,5) USING(CTL1)
/*
//CTL1CNTL DD *
  INCLUDE COND=(1,2,SS,EQ,C'10,99')
  INREC IFTHEN=(WHEN=(1,2,CH,EQ,C'10'),
    BUILD=(1:10,1,11:SEQNUM,8,ZD)),
   IFTHEN=(WHEN=NONE,
    BUILD=(2:6,5,11:SEQNUM,8,ZD))
  OUTFIL FNAMES=OUT,BUILD=(1,10)
/*
Back to top
View user's profile Send private message
yianis

New User


Joined: 14 Aug 2006
Posts: 45

PostPosted: Tue Oct 17, 2006 12:14 am    Post subject: Re: Holding a record in memory...
Reply with quote

Thanks Frank,

I've asked our systems programmer to see and repsonded:

"We will check to see if the PTF UK90006 or 7 is coming on our new zOS v1.7 SYSTEM this month."

Anyway, I hope we get it but in the meantime I'm using alternative code to do what I need to do..

Thanks
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 Oct 17, 2006 1:07 am    Post subject:
Reply with quote

Quote:
"We will check to see if the PTF UK90006 or 7 is coming on our new zOS v1.7 SYSTEM this month."


I asked our service team leader about that, and he said that when a customer orders a tape with maintenance on it they can specify the level of maintenance they want. For instance, they could say they want z/OS 1.7 with all PTFs through August, 2006. z/OS DFSORT V1R5 PTF UK90007 has been available since April, 2006. So tell your System Programmer to ask for a level of maintenance that will get you that PTF.
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
Page 1 of 1

 

Search our Forum:

Similar Topics
Topic Author Forum Replies Posted
No new posts Need to write record of PS File in ex... Chandan1993 JCL & VSAM 1 Wed Jun 07, 2017 1:35 am
No new posts Adding big TEXT lines to each record ... bshkris SYNCSORT 4 Sat May 06, 2017 1:40 am
This topic is locked: you cannot edit posts or make replies. Merge two files and update Trailer re... Yashashri JCL & VSAM 1 Thu May 04, 2017 12:54 pm
No new posts Sort Large record length cmsmoon DFSORT/ICETOOL 14 Tue Apr 11, 2017 5:49 pm
No new posts Format record to remove Leading zeroes Learncoholic DFSORT/ICETOOL 14 Wed Apr 05, 2017 2:43 pm


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