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
 

 

Get Previous record for matching current record

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

New User


Joined: 12 Feb 2009
Posts: 33
Location: Chennai, India

PostPosted: Tue Jul 19, 2011 10:36 pm    Post subject: Get Previous record for matching current record
Reply with quote

I have below CICS log which have information about what had happened in Online screens.

Code:
---------1---------2---------3---------4---------5--------6---------7---------8
REQUEST  18/07/2011 18:55:53 F02 G974650 223856902
RESPONSE 18/07/2011 18:55:54                       
REQUEST  18/07/2011 18:56:20 F02 G990101 579364447
RESPONSE 18/07/2011 18:56:20                       
REQUEST  18/07/2011 18:58:19 F02 G974606 789334456
RESPONSE 18/07/2011 18:58:19                       ABEND  SQL CODE: 803
REQUEST  18/07/2011 19:00:46 F02 G974890 323144410
RESPONSE 18/07/2011 19:00:47                       
REQUEST  18/07/2011 19:02:23 F02 G974650 112874160
RESPONSE 18/07/2011 19:02:23                       ABEND  SQL CODE: 803
REQUEST  18/07/2011 19:03:38 F02 G974601 032657752
RESPONSE 18/07/2011 19:03:38                       


In Production, customer support guys were trying to create Insurance policies and it fails with SQL Code 803. We found the cause for sql error .

But, we need to know for what customers it failed.
Position 42-50 have customer id in REQUEST record
Position 60-72 have the error 'SQL CODE: 803' in RESPONSE record

I want to get the Customer Id from REQUEST record for the SQL CODE 803 in RESPONSE record.

The output should be like this
Code:
789334456
112874160


I've tried using Splice and other methods, but no luck.I've searched this forum for similar posts, but couldn't find any.

Please help.
Back to top
View user's profile Send private message

sqlcode1

Active Member


Joined: 08 Apr 2010
Posts: 578
Location: USA

PostPosted: Tue Jul 19, 2011 10:55 pm    Post subject:
Reply with quote

See if below helps. Assuming input is FB/80.

Code:
//STEP0001 EXEC PGM=SORT                                               
//SORTIN   DD  *                                                       
REQUEST  18/07/2011 18:55:53 F02 G974650 223856902                     
RESPONSE 18/07/2011 18:55:54                                           
REQUEST  18/07/2011 18:56:20 F02 G990101 579364447                     
RESPONSE 18/07/2011 18:56:20                                           
REQUEST  18/07/2011 18:58:19 F02 G974606 789334456                     
RESPONSE 18/07/2011 18:58:19                       ABEND  SQL CODE: 803
REQUEST  18/07/2011 19:00:46 F02 G974890 323144410                     
RESPONSE 18/07/2011 19:00:47                                           
REQUEST  18/07/2011 19:02:23 F02 G974650 112874160                     
RESPONSE 18/07/2011 19:02:23                       ABEND  SQL CODE: 803
REQUEST  18/07/2011 19:03:38 F02 G974601 032657752                     
RESPONSE 18/07/2011 19:03:38                                           
//SORTOUT  DD  SYSOUT=*                                                 
//SYSIN    DD  *                                                       
 INREC IFTHEN=(WHEN=GROUP,RECORDS=2,BEGIN=(1,7,CH,EQ,C'REQUEST'),       
                                     PUSH=(81:42,9))                   
 SORT FIELDS=COPY                                                       
 OUTFIL INCLUDE=(52,20,CH,EQ,C'ABEND  SQL CODE: 803'),BUILD=(81,9)     
/*                                                                     
//SYSOUT   DD  SYSOUT=*                                                 
 

OUTPUT
Code:
789334456
112874160

Thanks,
Back to top
View user's profile Send private message
gcicchet

Senior Member


Joined: 28 Jul 2006
Posts: 1703
Location: Australia

PostPosted: Wed Jul 20, 2011 7:04 am    Post subject:
Reply with quote

Hi,

this
Code:
INREC IFTHEN=(WHEN=GROUP,RECORDS=2,BEGIN=(1,7,CH,EQ,C'REQUEST'),       
                                     PUSH=(81:42,9))       

can be changed to
Code:
 INREC IFTHEN=(WHEN=GROUP,RECORDS=2,PUSH=(81:42,9)) 



Gerry
Back to top
View user's profile Send private message
sqlcode1

Active Member


Joined: 08 Apr 2010
Posts: 578
Location: USA

PostPosted: Wed Jul 20, 2011 7:39 am    Post subject:
Reply with quote

Gerry,
Yes I agree,in this case it works but I wanted to make sure about grouping them just in case...

Thanks,
Back to top
View user's profile Send private message
dick scherrer

Site Director


Joined: 23 Nov 2006
Posts: 19270
Location: Inside the Matrix

PostPosted: Wed Jul 20, 2011 10:01 am    Post subject:
Reply with quote

Hello,

What happens when the entries are interleaved rather than grouped together (as shown in the example data)?
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 Need DB2 query to fetch previous row ! Chandan1993 DB2 10 Sat Jun 03, 2017 10:43 am
No new posts Adding big TEXT lines to each record ... bshkris SYNCSORT 4 Sat May 06, 2017 1:40 am
No new posts SMTP the current generation number of... Jyothi Kulunde JCL & VSAM 4 Thu May 04, 2017 4:08 pm
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


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