Portal | Manuals | References | Downloads | Info | Programs | JCLs | Mainframe wiki | Quick Ref
IBM Mainframe Computers Forums Index
 
Register
 
IBM Mainframe Computers Forums Index Mainframe: Search IBM Mainframe Forum: FAQ Memberlist Profile Log in to check your private messages Log in
 
Need help to format(INREC) records

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

Active User


Joined: 13 Sep 2006
Posts: 201
Location: USA

PostPosted: Thu Apr 03, 2008 6:11 pm    Post subject: Need help to format(INREC) records
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 Moderator


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

PostPosted: Thu Apr 03, 2008 10:08 pm    Post subject:
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

Senior Member


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

PostPosted: Thu Apr 03, 2008 11:45 pm    Post subject:
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: 2150
Location: At my coffee table

PostPosted: Fri Apr 04, 2008 12:07 am    Post subject: Re: Need help to format(INREC) records after the extraction
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 Moderator


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

PostPosted: Fri Apr 04, 2008 12:42 am    Post subject:
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 Moderator


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

PostPosted: Fri Apr 04, 2008 12:56 am    Post subject:
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: 201
Location: USA

PostPosted: Fri Apr 04, 2008 11:10 am    Post subject: Reply to: Need help to format(INREC) records
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 Moderator


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

PostPosted: Fri Apr 04, 2008 9:31 pm    Post subject:
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    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 Increment number for every group of r... srajendran2 DFSORT/ICETOOL 7 Thu Nov 09, 2017 10:31 pm
No new posts Matching and unmatched records!! Vignesh Sid SYNCSORT 3 Thu Nov 09, 2017 11:22 am
No new posts Formatting multiple records to a sing... Vignesh Sid SYNCSORT 3 Tue Nov 07, 2017 12:22 pm
No new posts Format Last Record differently from r... Learncoholic DFSORT/ICETOOL 5 Tue Oct 24, 2017 12:01 pm
No new posts Format issues using XMITIP MSGDD ssdjp1 CLIST & REXX 5 Mon Oct 23, 2017 8:47 pm

Facebook
Back to Top
 
Job Vacancies | Forum Rules | Bookmarks | Subscriptions | FAQ | Polls | Contact Us