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

Need help to format(INREC) records


IBM Mainframe Forums -> DFSORT/ICETOOL
Post new topic   Reply to topic
View previous topic :: View next topic  
Author Message
V S Amarendra Reddy

Active User


Joined: 13 Sep 2006
Posts: 216
Location: USA

PostPosted: Thu Apr 03, 2008 6:11 pm
Reply with quote

Hi all,

I have a requirement like this. I need to extract 3 different records from an input file and I need to format each record in a different manner. and write the same to an outfile. I will explain bit clear way.

Records I need to INCLUDE from the input file:
1."START PPPP123 . CREATE/AUDIT PRIMARY CATEGORIZATION."

2."A SERIOUS PROBLEM HAS OCCURRED IN XXXX. AN XXX XXXX XXXXX ON THE SOLUTION TO XXX XXXX TABLE (XXXXXX) IS NOT ON THE XXXXX"

3."TABLE. THE XXX IN ERROR IS : XXXXXXXXXXXXX-X--X FOR FACILITY XX CONTACT APPLICATION SUPPORT ANALYST."

After the extraction I need to format them as follows on each.

From record 1 I need to write "PPPP123"
From record 2 I need to write "AN XXX XXXX XXXXX ON THE SOLUTION TO XXX XXXX TABLE (XXXXXX) IS NOT ON THE XXXXX"
From record 3 I need to write "TABLE. THE XXX IN ERROR IS : XXXXXXXXXXXXX-X--X FOR FACILITY XX "

All the above should be written to a single file.

I am able to extract the records by simply writing the include in the control statement.

But I am failing to format them(In writing INREC or OUTREC) in the way I specified above.


Please help me writing the sort control statement


As of now I am using this code

Code:


//SORTOF1  DD DSN=DSN1,DISP=(OLD,PASS)             
//SORTOF2  DD DSN=DSN1,DISP=(MOD,PASS)             
//SORTOF3  DD DSN=DSN1,DISP=(MOD,PASS)             
//SYSIN    DD    *                                                 
 OPTION   COPY                                                     
 OUTFIL FILES=1,OUTREC=(1:8,7,153X),                               
                    INCLUDE=(2,6,CH,EQ,C'START ')                 
 OUTFIL FILES=2,OUTREC=(1:42,80,80X),                             
                    INCLUDE=(4,7,CH,EQ,C'SERIOUS')                 
 OUTFIL FILES=3,OUTREC=(1:2,64,96X),                               
                    INCLUDE=(10,21,CH,EQ,C'THE XXX IN ERROR IS :')
/*                                                                 


But the problem here is it is writing only 1&3 it is missing the second.

The output is as follows
PPPP123
TABLE. THE XXX IN ERROR IS : XXXXXXXXXXXXX-X--X FOR FACILITY XX

So the middle one is missing but the sort sysout is showing as 3 records out to dataset.


please help me in this regard.

Regards
Amar
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: Thu Apr 03, 2008 10:08 pm
Reply with quote

You can't use multiple OUTFIL statements with the same data set name the way you're trying to do.

If you want all of the records in one output file, then you should be using a DFSORT job like this with one output DD, and IFTHEN clauses rather than OUTFIL statements.

Code:

//S1    EXEC  PGM=ICEMAN
//SYSOUT    DD  SYSOUT=*
//SORTIN DD DSN=...  input file
//SORTOUT  DD DSN=...  output file
//SYSIN DD *
  OPTION COPY
  INREC IFOUTLEN=160,
   IFTHEN=(WHEN=(2,6,CH,EQ,C'START'),
    BUILD=(8,7)),
   IFTHEN=(WHEN=(4,7,CH,EQ,C'SERIOUS'),
    BUILD=(42,80)),
   IFTHEN=(WHEN=(10,21,CH,EQ,C'THE XXX IN ERROR IS :'),
    BUILD=(2,64))
/*
Back to top
View user's profile Send private message
Anuj Dhawan

Superior Member


Joined: 22 Apr 2006
Posts: 6250
Location: Mumbai, India

PostPosted: Thu Apr 03, 2008 11:45 pm
Reply with quote

Hi,

Little correction i would suggest in the subject of this thread..
Quote:
Need help to format(INREC) records after the extraction
INREC is used before SORTing the records. Perhaps, TS wanted to say OUTREC.
Back to top
View user's profile Send private message
CICS Guy

Senior Member


Joined: 18 Jul 2007
Posts: 2146
Location: At my coffee table

PostPosted: Fri Apr 04, 2008 12:07 am
Reply with quote

V S Amarendra Reddy wrote:
So the middle one is missing but the sort sysout is showing as 3 records out to dataset.

Since the displayed displacement for the third is wrong but works, could the displayed displacement for the second be wrong also?
Code:
 OUTFIL FILES=1,OUTREC=(1:8,7,153X),                               
                    INCLUDE=(2,6,CH,EQ,C'START ')                 
1."START PPPP123 .  CREATE/AUDIT PRIMARY CATEGORIZATION.
...0.....0
...2.....8
 OUTFIL FILES=2,OUTREC=(1:42,80,80X),                             
                    INCLUDE=(4,7,CH,EQ,C'SERIOUS')                 
2."A SERIOUS PROBLEM HAS OCCURRED IN XXXX. AN XXX XXXX
.....0.....................................4
.....4.....................................2
 OUTFIL FILES=3,OUTREC=(1:2,64,96X),                               
                    INCLUDE=(10,21,CH,EQ,C'THE XXX IN ERROR IS :')
3."TABLE. THE XXX IN ERROR IS : XXXXXXXXXXXXX-X--X FOR
...0......01
...2......90
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 Apr 04, 2008 12:42 am
Reply with quote

Quote:
Little correction i would suggest in the subject of this thread..
Quote:
Need help to format(INREC) records after the extraction
INREC is used before SORTing the records. Perhaps, TS wanted to say OUTREC.


I removed "after the extraction" from the Subject. Since it's a COPY, INREC is fine.
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 Apr 04, 2008 12:56 am
Reply with quote

Quote:
Since the displayed displacement for the third is wrong but works, could the displayed displacement for the second be wrong also?


Well, I'm not sure if the starting positions were a problem or not, but trying to use three OUTFILs to the same data set is definitely a problem.
I got the missing record when I tried this even with the correct positions for the INCLUDEs. IFTHEN should be used for this kind of thing, not OUTFIL.
Back to top
View user's profile Send private message
V S Amarendra Reddy

Active User


Joined: 13 Sep 2006
Posts: 216
Location: USA

PostPosted: Fri Apr 04, 2008 11:10 am
Reply with quote

Hi all,

Thank you very much for all to think on this . Especially to Frank.

Frank,
But here I got a problem while executing the code. I wanted to extract those 3 records only which we are formatting. But with this code it is formatting the 3 records in the way we wanted and along wiht them it is copying rest of all the records.

So I just added an INCLUDE condition before the INREC statement which will include those 3 alone and the rest is same as given by you.

Code:
//S1    EXEC  PGM=ICEMAN
//SYSOUT    DD  SYSOUT=*
//SORTIN DD DSN=...  input file
//SORTOUT  DD DSN=...  output file
//SYSIN DD *
  OPTION COPY
  INCLUDE  COND=(2,6,CH,EQ,C'START ',OR,4,7,CH,EQ,
               C'SERIOUS',OR,10,21,CH,EQ,
               C'THE XXX IN ERROR IS :')       

  INREC IFOUTLEN=160,
   IFTHEN=(WHEN=(2,6,CH,EQ,C'START'),
    BUILD=(8,7)),
   IFTHEN=(WHEN=(4,7,CH,EQ,C'SERIOUS'),
    BUILD=(42,80)),
   IFTHEN=(WHEN=(10,21,CH,EQ,C'THE XXX IN ERROR IS :'),
    BUILD=(2,64))
/*



It worked very fine..

Thank you one more time Frank and rest..

Regards
Amar
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 Apr 04, 2008 9:31 pm
Reply with quote

Amar,

I forgot you only wanted the three records. INCLUDE is the solution. I'm glad you figured it out.
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

 


Similar Topics
Topic Forum Replies
No new posts Compare 2 files and retrive records f... DFSORT/ICETOOL 3
No new posts Compare 2 files(F1 & F2) and writ... JCL & VSAM 8
No new posts Populate last day of the Month in MMD... SYNCSORT 2
No new posts Modifying Date Format Using DFSORT DFSORT/ICETOOL 9
No new posts Compare only first records of the fil... SYNCSORT 7
Search our Forums:

Back to Top