MVSFORUMS.com Forum Index MVSFORUMS.com
A Community of and for MVS Professionals
 
 FAQFAQ   SearchSearch   Quick Manuals   RegisterRegister 
 ProfileProfile   Log in to check your private messagesLog in to check your private messages   Log inLog in 

ICETOOL: Expressions in STARTREC & ENDREC ?
Goto page 1, 2  Next
 
Post new topic   Reply to topic   printer-friendly view    MVSFORUMS.com Forum Index -> Utilities
View previous topic :: View next topic  
Author Message
hsubra
Beginner


Joined: 18 Jun 2003
Posts: 25
Topics: 11

PostPosted: Mon Mar 07, 2005 5:24 pm    Post subject: ICETOOL: Expressions in STARTREC & ENDREC ? Reply with quote

Hi,

I need pickup block from my report. For example

ABC, SYSTEMS
REPORT Q
-----------------------------
AEXREC001 1222.22
---------002 0000.00
---------003 0000.50
*****------1222.72

BDATA 001 ...
..
******
AEXREC 001
...
******

Here I need all the records start from AEXREC to endwith next ****** in position 1 to 6. ( I kept the block in red) .. Is it possible do with ICETOOL? Is there anyway i can use expressions in STARTREC & ENDREC ?

Please Advise and appriciate your immediate help ...

Thanks You,
Subra
Back to top
View user's profile Send private message
Frank Yaeger
Sort Forum Moderator
Sort Forum Moderator


Joined: 02 Dec 2002
Posts: 1618
Topics: 31
Location: San Jose

PostPosted: Mon Mar 07, 2005 5:56 pm    Post subject: Reply with quote

No, you can't use a logical condition in STARTREC or ENDREC. But you can do what you want with the following DFSORT/ICETOOL job. (I assumed you really had ****** in your input record rather than the ***** you showed.)

Code:

//S1    EXEC  PGM=ICETOOL
//TOOLMSG DD SYSOUT=*
//DFSMSG DD SYSOUT=*
//IN DD *
ABC, SYSTEMS
REPORT Q
-----------------------------
AEXREC001   1222.22
---------002   0000.00
---------003   0000.50
******------1222.72
BDATA    001   ...
/*
//T1 DD DSN=&&T1,UNIT=SYSDA,SPACE=(TRK,(5,5)),DISP=(,PASS)
//T2 DD DSN=&&T2,UNIT=SYSDA,SPACE=(TRK,(5,5)),DISP=(,PASS)
//CTL2CNTL DD DSN=*.T1,VOL=REF=*.T1,DISP=(OLD,PASS)
//         DD DSN=*.T2,VOL=REF=*.T2,DISP=(OLD,PASS)
//OUT DD SYSOUT=*
//TOOLIN DD *
* IN->T1:  Generate:
*   OUTFIL FNAMES=OUT,STARTREC=n,
* where n is the seqnum of the AEXREC record
* IN->T2:  Generate:
*     ENDREC=m
* where m is the seqnum of the ****** record
  COPY FROM(IN) USING(CTL1)
* IN->OUT:  Use the generated control statements.
  COPY FROM(IN) USING(CTL2)
/*
//CTL1CNTL DD *
  INREC FIELDS=(1,80,81:SEQNUM,8,ZD)
  OUTFIL FNAMES=T1,INCLUDE=(1,6,CH,EQ,C'AEXREC'),
    OUTREC=(C' OUTFIL FNAMES=OUT,STARTREC=',81,8,C',',80:X)
  OUTFIL FNAMES=T2,INCLUDE=(1,6,CH,EQ,C'******'),
    OUTREC=(C' ENDREC=',81,8,80:X)
/*

_________________
Frank Yaeger - DFSORT Development Team (IBM)
Specialties: JOINKEYS, FINDREP, WHEN=GROUP, ICETOOL, Symbols, Migration
DFSORT is on the Web at:
www.ibm.com/storage/dfsort
Back to top
View user's profile Send private message Send e-mail Visit poster's website
hsubra
Beginner


Joined: 18 Jun 2003
Posts: 25
Topics: 11

PostPosted: Mon Mar 07, 2005 11:44 pm    Post subject: Reply with quote

Hi Frank,

Thanks for the immediate help. Your JCL work fine , if i have one block to select. I have multiple blocks line that .

My input is

ABC, SYSTEMS
REPORT Q
-----------------------------
AEXREC001 1222.22
---------002 0000.00
---------003 0000.50
******------1222.72

BDATA 001 ...
******---
AEXREC00X 1222.22
---------00Y 0000.00
---------00Z 0000.50
******------1222.72

BDATA 001 ...
******---

My output should be ,
AEXREC001 1222.22
---------002 0000.00
---------003 0000.50
******------1222.72
AEXREC00X 1222.22
---------00Y 0000.00
---------00Z 0000.50
******------1222.72


Thanks
Subra
Back to top
View user's profile Send private message
Frank Yaeger
Sort Forum Moderator
Sort Forum Moderator


Joined: 02 Dec 2002
Posts: 1618
Topics: 31
Location: San Jose

PostPosted: Tue Mar 08, 2005 11:32 am    Post subject: Reply with quote

I can't think of a solution for extracting multiple blocks other than to use an E15 exit with the appropriate logic.
_________________
Frank Yaeger - DFSORT Development Team (IBM)
Specialties: JOINKEYS, FINDREP, WHEN=GROUP, ICETOOL, Symbols, Migration
DFSORT is on the Web at:
www.ibm.com/storage/dfsort
Back to top
View user's profile Send private message Send e-mail Visit poster's website
Alain Benveniste
Beginner


Joined: 04 May 2003
Posts: 92
Topics: 4
Location: Paris, France

PostPosted: Wed Mar 09, 2005 3:27 am    Post subject: Reply with quote

Here is the Jcl that do what you want. you also need the new DFSORT PTF from Dec 2004.
Code:

//STEP0001 EXEC PGM=ICETOOL
//DFSMSG   DD SYSOUT=*
//TOOLMSG  DD SYSOUT=*
//TOOLIN   DD *
  COPY FROM(IN) TO(OUTX) USING(ICE0)
/*
//IN       DD *
ABC, SYSTEMS
REPORT Q
-----------------------------
AEXREC001 1222.22
---------002 0000.00
---------003 0000.50
******------1222.72
BDATA 001 ...
******---
AEXREC00X 1222.22
---------00Y 0000.00
---------00Z 0000.50
******------1222.72
BDATA 001 ...
******---
/*
//OUTX     DD SYSOUT=*
//ICE0CNTL DD *
  OPTION SKIPREC=3
  INREC IFTHEN=(WHEN=INIT,OVERLAY=(81:SEQNUM,5,ZD)),
        IFTHEN=(WHEN=(1,6,CH,EQ,C'AEXREC'),
                OVERLAY=(81:SEQNUM,5,ZD),
                HIT=NEXT),
        IFTHEN=(WHEN=(1,6,CH,NE,C'AEXREC'),
                OVERLAY=(86:SEQNUM,5,ZD,
                         81:81,5,ZD,SUB,86,5,ZD,M11,LENGTH=5),
                HIT=NEXT),
        IFTHEN=(WHEN=ANY,
                OVERLAY=(81:SEQNUM,5,ZD,RESTART=(81,5)))
  OUTFIL FNAMES=OUTX,
         INCLUDE=(81,5,CH,GE,C'00001',AND,81,5,CH,LE,C'00004'),
         OUTREC=(1,80)
/*

Here is the logic
Code:

                       Col1 Col2 Col3 Col4 Col5
AEXREC001 1222.22      01   01        01   01
---------002 0000.00   02        01   01   02
---------003 0000.50   03        02   01   03
******------1222.72    04        03   01   04
BDATA 001 ...          05        04   01   05
******---              06        05   01   06
AEXREC00X 1222.22      07   02        02   01
---------00Y 0000.00   08        06   02   02
---------00Z 0000.50   09        07   02   03
******------1222.72    10        08   02   04
BDATA 001 ...          11        09   02   05
******---              12        10   02   06

Col1 : SEQNUM all the records
Col2 : SEQNUM only the HDR AEXREC
Col3 : SEQNUM only the details records
Col4 : IF CH,EQ,C'AEXREC' THEN Col4=Col2
                          ELSE Col4=Col1-Col3
Col5 : SEQNUM with RESTART feature on Col4

Frank,

If I code the JCL with
Code:

INCLUDE COND=(81,5,CH,GE,C'00001',AND,81,5,CH,LE,C'00004')
OUTREC FIELDS=(1,80)

I generate the message
Code:

ICE027A 2 END OF          FIELD BEYOND MAXIMUM RECORD LENGTH

and I don't understand why because all the records are at least 85 bytes long.

Alain
Back to top
View user's profile Send private message
Frank Yaeger
Sort Forum Moderator
Sort Forum Moderator


Joined: 02 Dec 2002
Posts: 1618
Topics: 31
Location: San Jose

PostPosted: Wed Mar 09, 2005 11:22 am    Post subject: Reply with quote

Alain,

Clever. Note that this only works if each group has the same number of records (in this case 4). If group 1 had 4 records and group 2 had 5 records, this wouldn't work. Do you have a trick for the case where the groups can have different numbers of records?

The reason you got the ICE027A with the INCLUDE statement, but NOT with the INCLUDE parameter of the OUTFIL statement is that the INCLUDE statement is processed before the INREC statement, whereas the OUTFIL statement is processed after the INREC statement. So the INCLUDE statement does not see the changes you make with the later INREC statement whereas the OUTFIL statement does see the changes you make with the earlier INREC statement.
_________________
Frank Yaeger - DFSORT Development Team (IBM)
Specialties: JOINKEYS, FINDREP, WHEN=GROUP, ICETOOL, Symbols, Migration
DFSORT is on the Web at:
www.ibm.com/storage/dfsort
Back to top
View user's profile Send private message Send e-mail Visit poster's website
Alain Benveniste
Beginner


Joined: 04 May 2003
Posts: 92
Topics: 4
Location: Paris, France

PostPosted: Wed Mar 09, 2005 12:34 pm    Post subject: Reply with quote

Frank,
Do you allow me to test C'AEXREC' and C'BDATA', if yes I will try to post something tomorrow.

Of course ...

Alain
Back to top
View user's profile Send private message
Frank Yaeger
Sort Forum Moderator
Sort Forum Moderator


Joined: 02 Dec 2002
Posts: 1618
Topics: 31
Location: San Jose

PostPosted: Wed Mar 09, 2005 1:15 pm    Post subject: Reply with quote

Alain,

A test of the starting string for the group (AEXREC) and the ending string for the group (******) would be more general. Is the BDATA test (record after end of group) really needed rather than the ****** test (record at end of group) for what you want to do?
_________________
Frank Yaeger - DFSORT Development Team (IBM)
Specialties: JOINKEYS, FINDREP, WHEN=GROUP, ICETOOL, Symbols, Migration
DFSORT is on the Web at:
www.ibm.com/storage/dfsort
Back to top
View user's profile Send private message Send e-mail Visit poster's website
Alain Benveniste
Beginner


Joined: 04 May 2003
Posts: 92
Topics: 4
Location: Paris, France

PostPosted: Wed Mar 09, 2005 1:46 pm    Post subject: Reply with quote

Frank,

In the 2nd example given by Hsubra we have duplicates (******---) records, one must be kept, one must be removed. That's why I wanted to use (BDATA). I understand what you mean by a more global solution and that's why I am asking you if you really want me to preserve this 'constraint' or can I bypass it ? I can also try to find something for the both cases.

Alain
Back to top
View user's profile Send private message
Frank Yaeger
Sort Forum Moderator
Sort Forum Moderator


Joined: 02 Dec 2002
Posts: 1618
Topics: 31
Location: San Jose

PostPosted: Wed Mar 09, 2005 2:20 pm    Post subject: Reply with quote

Is it just the unmatched ending record (******) that's the problem or any record in the group that has a duplicate outside the group?

I would consider the ideal group solution to be able to just keep the records from the starting string to the ending string for each group, and omit any records outside the groups. I would stipulate that every group has a starting and ending string. I would allow an ending string without a starting string and not consider that to be a group. I would allow any number of records before the first group and after the last group. I would allow duplicates anywhere. So the solution I'm asking about would be able to handle this:

Input
Y
X
Z
...
START
A
B
C
END
C
B
START
C
B
A
END
A
D
END
X
...

Output
START
A
B
C
END
START
C
B
A
END

Of course, I'm sure there are different variations of this in the real world that pose less difficulty for which solutions stipulating more constraints would be useful.
_________________
Frank Yaeger - DFSORT Development Team (IBM)
Specialties: JOINKEYS, FINDREP, WHEN=GROUP, ICETOOL, Symbols, Migration
DFSORT is on the Web at:
www.ibm.com/storage/dfsort
Back to top
View user's profile Send private message Send e-mail Visit poster's website
hsubra
Beginner


Joined: 18 Jun 2003
Posts: 25
Topics: 11

PostPosted: Tue Mar 15, 2005 1:49 pm    Post subject: Reply with quote

Frank/Alain,

I am back from a small vacation. I saw the nice trick from Alain, when we have a number of records is same in each group. I have tried IFTHEN before my vaction , for me it did not work .. Nice trick Alain. As Frank told, I can not restrict the # of records in the group.

Because of the urgency, I am proposing HLL . But I want to try one more time with ICETOOL.

Is there any way i can reformat my input like this ..

INPUT:
Code:

AEXREC001 1222.22
---------002 0000.00
---------003 0000.50
******------1222.72
BDATA 001 ...
******---
AEXREC00X 1222.22
---------00Y 0000.00
---------00Z 0000.50
******------1222.72
BDATA 001 ...
******---

My output CAN be ,
Code:

AEXREC001 1222.22
AEXREC002 0000.00
AEXREC003 0000.50
******------1222.72
AEXREC00X 1222.22
AEXREC00Y 0000.00
AEXREC00Z 0000.50
******------1222.72

OR
Code:

AEXREC001 1222.22 002 0000.00 003 0000.50
AEXREC00X 1222.22 00Y 0000.00 00Z 0000.50

Thanks,
Subra
Back to top
View user's profile Send private message
Alain Benveniste
Beginner


Joined: 04 May 2003
Posts: 92
Topics: 4
Location: Paris, France

PostPosted: Wed Mar 16, 2005 12:41 pm    Post subject: Reply with quote

Hsubra,

The best way to solve the problem is to go step by step and not directly answer the request.
That
Back to top
View user's profile Send private message
hsubra
Beginner


Joined: 18 Jun 2003
Posts: 25
Topics: 11

PostPosted: Wed Mar 16, 2005 2:22 pm    Post subject: Reply with quote

Alain,

Thanks for the nice work. Give me sometime to understand the logic and let me try out .

Cheers,
Subra
Back to top
View user's profile Send private message
Alain Benveniste
Beginner


Joined: 04 May 2003
Posts: 92
Topics: 4
Location: Paris, France

PostPosted: Sat Jun 04, 2005 4:50 am    Post subject: Reply with quote

Alain Benveniste wrote:
Hsubra,

The best way to solve the problem is to go step by step and not directly answer the request.
That
Back to top
View user's profile Send private message
Alain Benveniste
Beginner


Joined: 04 May 2003
Posts: 92
Topics: 4
Location: Paris, France

PostPosted: Sat Jun 04, 2005 8:00 am    Post subject: Reply with quote

I have only corrected minor mistakes in the examples
Here is the cntl statement for example I to IV that could be a little bit faster :
Code:

//ICE0CNTL DD *
  INREC IFTHEN=(WHEN=INIT,OVERLAY=(81:SEQNUM,5,ZD)),
        IFTHEN=(WHEN=(1,3,CH,NE,C'END'),
                OVERLAY=(86:SEQNUM,5,ZD,START=0,INCR=1),
                HIT=NEXT),
        IFTHEN=(WHEN=(1,5,CH,NE,C'START'),
                OVERLAY=(91:SEQNUM,5,ZD,START=1,INCR=1),
                HIT=NEXT),
        IFTHEN=(WHEN=(1,5,CH,EQ,C'START'),
                OVERLAY=(81:81,5,ZD,SUB,86,5,ZD,M11,LENGTH=5)),
        IFTHEN=(WHEN=(1,3,CH,EQ,C'END'),
                OVERLAY=(81:81,5,ZD,SUB,91,5,ZD,M11,LENGTH=5)),
        IFTHEN=(WHEN=(86,5,ZD,EQ,91,5,ZD),
                OVERLAY=(81:81,5,ZD,SUB,86,5,ZD,M11,LENGTH=5)),
        IFTHEN=(WHEN=(86,5,ZD,NE,91,5,ZD),
                OVERLAY=(81:C'00000'))
  OUTFIL FNAMES=OUTX,
         OMIT=(81,5,CH,EQ,C'00000'),
         OUTREC=(1,80)
/*
Back to top
View user's profile Send private message
Display posts from previous:   
Post new topic   Reply to topic   printer-friendly view    MVSFORUMS.com Forum Index -> Utilities All times are GMT - 5 Hours
Goto page 1, 2  Next
Page 1 of 2

 
Jump to:  
You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot vote in polls in this forum


MVSFORUMS
Powered by phpBB © 2001, 2005 phpBB Group