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

Can we use INCLUDE & OUTREC together in OUTFIL?


IBM Mainframe Forums -> JCL & VSAM
Post new topic   Reply to topic
View previous topic :: View next topic  
Author Message
suvarna

New User


Joined: 24 Aug 2005
Posts: 13

PostPosted: Fri Aug 26, 2005 10:42 am
Reply with quote

Hi Guys,

Thanks to all of u for ur help.
I am solving that problem in a different way combining JCL & REXX.

I am facing a new problem now. I am trying to sort a file into four different output files using OUTFIL. But i dont want the entire record. So I used INCLUDE COND to achieve that. Again i want to truncate some parts from that record. For this when i use OUTREC the job is abending that the syntax is not correct.

When this syntax is used the output is
CTR301I MOB.#CO.R01.RT01.I402P01.INSURANC.G0021V00 +001 CB
in one line

//SYSIN DD *
SORT FIELDS=(14,42,CH,A)
OUTFIL FILES=1,
INCLUDE=(23,2,CH,EQ,C'01',AND,39,8,CH,EQ,C'INSURANC')

But when i use the following syntax it is abending.
//SYSIN DD *
SORT FIELDS=(14,42,CH,A)
OUTFIL FILES=1,
INCLUDE=(23,2,CH,EQ,C'01',AND,39,8,CH,EQ,C'INSURANC')
OUTREC FIELDS=(1:14,42)

Can u help me to solve it ?
Back to top
View user's profile Send private message
radhakrishnan82

Active User


Joined: 31 Mar 2005
Posts: 435
Location: chennai, India

PostPosted: Fri Aug 26, 2005 11:39 am
Reply with quote

Using ICETOOL,its working.

Code:
//CTL1CNTL     DD  * *** CONSTANT CONTROL CARDS *** 
  SORT FIELDS=(1,1,CH,A)                             
  OUTFIL FNAMES=OUT1,                               
  INCLUDE=(1,1,CH,EQ,C'2')                           
  OUTREC FIELDS=(1:1,6)                             
  OUTFIL FNAMES=OUT2,                               
  INCLUDE=(1,1,CH,EQ,C'1')                           
  OUTREC FIELDS=(2:1,6)                             


the output is as expected.
Back to top
View user's profile Send private message
radhakrishnan82

Active User


Joined: 31 Mar 2005
Posts: 435
Location: chennai, India

PostPosted: Fri Aug 26, 2005 11:51 am
Reply with quote

suvarna,

try this

Code:
//SYSIN DD *
SORT FIELDS=(14,42,CH,A)
OUTFIL FNAMES=1,   replace FILES with FNAMES
INCLUDE=(23,2,CH,EQ,C'01',AND,39,8,CH,EQ,C'INSURANC')
OUTREC FIELDS=(1:14,42)
Back to top
View user's profile Send private message
suvarna

New User


Joined: 24 Aug 2005
Posts: 13

PostPosted: Fri Aug 26, 2005 2:29 pm
Reply with quote

Hi Guys

Thanks to u all for the help :-)
It is working now.
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: Fri Aug 26, 2005 8:56 pm
Reply with quote

The problem here is that you don't understand the "order" of processing of the control statements.

You used:

Code:

  SORT FIELDS=(14,42,CH,A)
  OUTFIL FILES=1,
     INCLUDE=(23,2,CH,EQ,C'01',AND,39,8,CH,EQ,C'INSURANC')
  OUTREC FIELDS=(1:14,42)


Regardless of the order in which you code the statements, they are processed in the following order: SORT statement, OUTREC statement, OUTFIL statements. The OUTREC statement reformats the sorted records to 42 bytes. The OUTFIL INCLUDE operates against the reformatted record, but tries to access 39,8 which is beyond the end of the 42-byte reformatted record.

What you probably want is to use the OUTREC parameter of OUTFIL rather than the OUTREC statement, e.g.

Code:

  SORT FIELDS=(14,42,CH,A)
  OUTFIL FILES=1,
     INCLUDE=(23,2,CH,EQ,C'01',AND,39,8,CH,EQ,C'INSURANC'),
     OUTREC=(1:14,42)


The order of processing in this case is: SORT statement, OUTFIL INCLUDE, OUTFIL OUTREC. So the OUTFIL INCLUDE operates against the sorted input records, and the OUTFIL OUTREC operates against the included records.

Quote:
Using ICETOOL,its working.

Code:
//CTL1CNTL DD * *** CONSTANT CONTROL CARDS ***
SORT FIELDS=(1,1,CH,A)
OUTFIL FNAMES=OUT1,
INCLUDE=(1,1,CH,EQ,C'2')
OUTREC FIELDS=(1:1,6)
OUTFIL FNAMES=OUT2,
INCLUDE=(1,1,CH,EQ,C'1')
OUTREC FIELDS=(2:1,6)


Well in this case the first OUTREC statement reformats the records to 6 bytes and the OUTFIL INCLUDEs operate against those 6 bytes. Since the INCLUDEs have 1,1, it doesn't matter if they operate against the input records or the reformatted records - position 1 has the same value eiter way. The second OUTREC statement is ignored as a duplicate.
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 -> JCL & VSAM

 


Similar Topics
Topic Forum Replies
No new posts INCLUDE OMIT COND for Multiple values... DFSORT/ICETOOL 5
No new posts Calling DFSORT from Cobol, using OUTF... DFSORT/ICETOOL 5
No new posts OUTFIL with SAVE option DFSORT/ICETOOL 7
No new posts question on Outrec and sort #Digvijay DFSORT/ICETOOL 20
This topic is locked: you cannot edit posts or make replies. Sort to include records of file 2 int... Java & MQSeries 1
Search our Forums:

Back to Top