copy a record based on condition on the next record



Support for NetApp SyncSort for z/OS, Visual SyncSort, SYNCINIT, SYNCLIST and SYNCTOOL

copy a record based on condition on the next record

Postby vishnusankar » Fri Mar 05, 2010 2:31 pm

Hi,
Can you please help me achieve below requirement using DFSORT.
I want to copy records that are satisfying the condition on that record and on the next record.

for eg:
input file:
01. USER4 TRIED LOGIN AT 03:00
02. LOGIN SUCCESS
03. USER2 TRIED LOGIN AT 04:00
04. LOGIN FAIL
05. USER2 TRIED LOGIN AT 04:55
06. LOGIN SUCCESS
07. USER5 TRIED LOGIN AT 05:00
08. LOGIN FAIL
09. USER4 TRIED LOGIN AT 06:00
10. LOGIN SUCCESS
11. USER1 TRIED LOGIN AT 07:00
12. LOGIN SUCCESS

I want output to contain only the successful login attempts for the users USER2, USER4 and USER5.
In this case, the output file should contain the records 01, 05 & 09 only.

output file:
01. USER4 TRIED LOGIN AT 03:00
05. USER2 TRIED LOGIN AT 04:55
09. USER4 TRIED LOGIN AT 06:00

Thanks!
Vishnu.
vishnusankar
 
Posts: 6
Joined: Thu Mar 04, 2010 6:54 pm
Has thanked: 0 time
Been thanked: 0 time

Re: copy a record based on condition on the next record

 

Re: copy a record based on condition on the next record

Postby skolusu » Fri Mar 05, 2010 10:01 pm

vishnusankar,

Is there any reason as to why you did NOT pick record #11 in output? Your output should have it based on your rules. Assuming that it is a typo the following DFSORT/ICETOOL JCL will give you the desired results. I assumed that your input is FB recfm and LRECL of 80

//STEP0100 EXEC PGM=ICETOOL                               
//TOOLMSG  DD SYSOUT=*                                   
//DFSMSG   DD SYSOUT=*                                   
//IN       DD *                                           
01. USER4 TRIED LOGIN AT 03:00                           
02. LOGIN SUCCESS                                         
03. USER2 TRIED LOGIN AT 04:00                           
04. LOGIN FAIL                                           
05. USER2 TRIED LOGIN AT 04:55                           
06. LOGIN SUCCESS                                         
07. USER5 TRIED LOGIN AT 05:00                           
08. LOGIN FAIL                                           
09. USER4 TRIED LOGIN AT 06:00                           
10. LOGIN SUCCESS                                         
11. USER1 TRIED LOGIN AT 07:00                           
12. LOGIN SUCCESS                                         
//OUT      DD SYSOUT=*                                   
//TOOLIN   DD *                                           
  SELECT FROM(IN) TO(OUT) FIRSTDUP ON(81,8,CH) USING(CTL1)
//CTL1CNTL DD *                                           
  SORT FIELDS=COPY                                       
  INREC IFTHEN=(WHEN=INIT,OVERLAY=(81:SEQNUM,8,ZD)),     
  IFTHEN=(WHEN=(5,13,CH,EQ,C'LOGIN SUCCESS'),             
  OVERLAY=(81:81,8,ZD,SUB,+1,M11,LENGTH=8))               
  OUTFIL FNAMES=OUT,BUILD=(1,80)                         
//*
Kolusu - DFSORT Development Team (IBM)
DFSORT is on the Web at:
www.ibm.com/storage/dfsort
skolusu
 
Posts: 586
Joined: Wed Apr 02, 2008 10:38 pm
Has thanked: 0 time
Been thanked: 39 times

Re: copy a record based on condition on the next record

Postby vishnusankar » Sat Mar 06, 2010 5:46 pm

Hi skolusu,

Thanks! for the reply.
record#11 is not needed in the output because i need the report for only USER2, USER4 and USER5.

Also, I tried running the code but I am not getting any output in SPOOL. I am getting only the below messages.
JESLOG
JCL
SYSMSG
TOOLMSG
DFSMSG

I doubt if ICETOOL works here. Can you tell me how to check my system is ICETOOL compatible?

Thanks
Vishnu.
vishnusankar
 
Posts: 6
Joined: Thu Mar 04, 2010 6:54 pm
Has thanked: 0 time
Been thanked: 0 time

Re: copy a record based on condition on the next record

Postby dick scherrer » Sat Mar 06, 2010 9:46 pm

Hello,

Suggest you copy/paste the solution skolusu provided with NO modifications and run that.

Then, post the TOOLMSG and DFSMSG information with the contents of OUT (if any).
Hope this helps,
d.sch.
User avatar
dick scherrer
Global moderator
 
Posts: 6304
Joined: Sat Jun 09, 2007 8:58 am
Has thanked: 3 times
Been thanked: 91 times

Re: copy a record based on condition on the next record

Postby vishnusankar » Fri Mar 26, 2010 4:11 pm

Hey.. sorry..i was out of work for sometime..

i ll update you shortly..

regards,
Vishnu.
vishnusankar
 
Posts: 6
Joined: Thu Mar 04, 2010 6:54 pm
Has thanked: 0 time
Been thanked: 0 time

Re: copy a record based on condition on the next record

Postby vishnusankar » Fri Mar 26, 2010 4:19 pm

Hi,

The TOOLMSG message below:
FILE> WBVG00.WBVG00D.JOB06789.D0000103.?,2010.085,06:43:44:75
SYT000I SYNCTOOL RELEASE 1.6.0 - COPYRIGHT 2007 SYNCSORT INC.
SYT001I INITIAL PROCESSING MODE IS "STOP"
SYT002I "TOOLIN" INTERFACE BEING USED

SELECT FROM(IN) TO(OUT) FIRSTDUP ON(81,8,CH) USING(CTL1)
SYT020I SYNCSORT CALLED WITH IDENTIFIER "0001"
SYT031I NUMBER OF RECORDS PROCESSED: 000000000000012
SYT026I NUMBER OF SELECTED RECORDS: 000000000000000
SYT030I OPERATION COMPLETED WITH RETURN CODE 0

SYT004I SYNCTOOL PROCESSING COMPLETED WITH RETURN CODE 0

DFSMSG message below:


SYNCSORT FOR Z/OS 1.3.0.0RI U.S. PATENTS: 4210961, 5117495 (C) 2007 SYNCSO
z/OS 1.9.0
SYNCSORT LICENSED FOR CPU SERIAL NUMBER 14154, MODEL 2097 507 LICEN
CTL1CNTL :
SORT FIELDS=COPY
INREC IFTHEN=(WHEN=INIT,OVERLAY=(81:SEQNUM,8,ZD)),
IFTHEN=(WHEN=(5,13,CH,EQ,C'LOGIN SUCCESS'),
OVERLAY=(81:81,8,ZD,SUB,+1,M11,LENGTH=8))
OUTFIL FNAMES=OUT,BUILD=(1,80)
PARMLIST :
OPTION RESINV=0,ARESINV=0,MSGDDN=DFSMSG,SORTIN=IN,SORTDD=CTL1,SORTOUT=OUT,DYNAL
OC,CMP=CLC,NOVLSHRT,EQUALS
SORT FIELDS=(00081,0008,CH,A)
MODS E35=(SYNCT$35,4096,,N)
WER428I CALLER-PROVIDED IDENTIFIER IS "0001"
WER276B SYSDIAG= 735994, 1738595, 1738595, 2915131
WER164B 8,840K BYTES OF VIRTUAL STORAGE AVAILABLE, MAX REQUESTED,
WER164B 0 BYTES RESERVE REQUESTED, 3,109,320 BYTES USED
WER146B 128K BYTES OF EMERGENCY SPACE ALLOCATED
WER108I IN : RECFM=FB ; LRECL= 80; BLKSIZE= 27920
WER257I INREC RECORD LENGTH = 88
WER238I POTENTIALLY INEFFICIENT USE OF INREC
WER110I OUT : RECFM=FB ; LRECL= 80; BLKSIZE= 27920
WER410B 5,760K BYTES OF VIRTUAL STORAGE AVAILABLE ABOVE THE 16MEG LINE,
WER410B 0 BYTES RESERVE REQUESTED, 100K BYTES USED
WER055I INSERT 0, DELETE 12
WER405I OUT : DATA RECORDS OUT 0; TOTAL RECORDS OUT 0
WER211B SYNCSMF CALLED BY SYNCSORT; RC=0000
WER416B IN : EXCP'S=1,UNIT=3390,DEV=BCA6,CHP=B7BABCEEF6B3,VOL=TSCM0V
WER416B OUTFIL WAS USED FOR OUT
WER054I RCD IN 12, OUT 0
WER169I RELEASE 1.3 BATCH 0485 TPF LEVEL 0.0
WER052I END SYNCSORT - WBVG00D,STEP0100,,DIAG=AA00,71C0,828E,004E,E262,4CCB,02

Please advise.

with thanks!,
vishnu.
vishnusankar
 
Posts: 6
Joined: Thu Mar 04, 2010 6:54 pm
Has thanked: 0 time
Been thanked: 0 time

Re: copy a record based on condition on the next record

Postby Frank Yaeger » Fri Mar 26, 2010 9:01 pm

The SYT and WER messages indicate you're using Syncsort/SYNCTOOL, not DFSORT/ICETOOL. I'm moving this thread to the appropriate Forum.
Frank Yaeger - DFSORT Development Team (IBM) - yaeger@us.ibm.com
Specialties: JOINKEYS, FINDREP, WHEN=GROUP, ICETOOL, Symbols, Migration
=> DFSORT/MVS is on the Web at http://www.ibm.com/storage/dfsort
User avatar
Frank Yaeger
Global moderator
 
Posts: 1080
Joined: Sat Jun 09, 2007 8:44 pm
Has thanked: 0 time
Been thanked: 14 times

Re: copy a record based on condition on the next record

Postby vishnusankar » Fri Mar 26, 2010 10:00 pm

can anybody tell me how to achieve this using syncsort?

regards,
vishnu.
vishnusankar
 
Posts: 6
Joined: Thu Mar 04, 2010 6:54 pm
Has thanked: 0 time
Been thanked: 0 time

Re: copy a record based on condition on the next record

Postby Alissa Margulies » Fri Mar 26, 2010 10:47 pm

Hello Vishnu.

Here is a SyncSort for z/OS 1.3.2 job that will produce the requested output:
//STEP1  EXEC PGM=SORT                                               
//SYSOUT   DD SYSOUT=*                                               
//SORTIN   DD *                                                     
01. USER4 TRIED LOGIN AT 03:00                                       
02. LOGIN SUCCESS                                                   
03. USER2 TRIED LOGIN AT 04:00                                       
04. LOGIN FAIL                                                       
05. USER2 TRIED LOGIN AT 04:55                                       
06. LOGIN SUCCESS                                                   
07. USER5 TRIED LOGIN AT 05:00                                       
08. LOGIN FAIL                                                       
09. USER4 TRIED LOGIN AT 06:00                                       
10. LOGIN SUCCESS                                                   
11. USER1 TRIED LOGIN AT 07:00                                       
12. LOGIN SUCCESS                                                   
//SORTOUT  DD SYSOUT=*                                               
//SYSIN    DD *                                                     
  SORT FIELDS=COPY                                                   
  OUTREC IFTHEN=(WHEN=GROUP,BEGIN=(5,4,CH,EQ,C'USER'),PUSH=(35:1,30))
  OUTFIL BUILD=(35,30),                                               
     INCLUDE=(11,7,CH,EQ,C'SUCCESS',AND,43,1,CH,EQ,L(C'2',C'4',C'5'))
/*                                                                   

Please note, you are running an earlier release of SyncSort that does not support WHEN=GROUP. The ICETOOL application previously provided by skolusu should also provide you with the requested output, provided you make a small change so that USER1 is not included in the output:
OUTFIL FNAMES=OUT,BUILD=(1,80),
       INCLUDE=(9,1,CH,EQ,L(C'2',C'4',C'5'))
Alissa Margulies
Syncsort Mainframe Product Services
201-930-8260
zos_tech@syncsort.com
Alissa Margulies
Global moderator
 
Posts: 369
Joined: Tue Feb 26, 2008 11:15 pm
Location: USA
Has thanked: 1 time
Been thanked: 1 time

Re: copy a record based on condition on the next record

Postby Alissa Margulies » Fri Mar 26, 2010 11:03 pm

Here is another SyncSort for z/OS 1.3 alternative you can try:
//SORT1 EXEC PGM=SORT                                       
//SORTIN  DD *                                               
01. USER4 TRIED LOGIN AT 03:00                               
02. LOGIN SUCCESS                                           
03. USER2 TRIED LOGIN AT 04:00                               
04. LOGIN FAIL                                               
05. USER2 TRIED LOGIN AT 04:55                               
06. LOGIN SUCCESS                                           
07. USER5 TRIED LOGIN AT 05:00                               
08. LOGIN FAIL                                               
09. USER4 TRIED LOGIN AT 06:00                               
10. LOGIN SUCCESS                                           
11. USER1 TRIED LOGIN AT 07:00                               
12. LOGIN SUCCESS                                           
//SORTOUT  DD SYSOUT=*                                       
//SYSOUT   DD SYSOUT=*                                       
//SYSIN    DD *                                             
  INREC IFTHEN=(WHEN=INIT,OVERLAY=(81:SEQNUM,8,ZD,89:X'F1')),
  IFTHEN=(WHEN=(11,7,CH,EQ,C'SUCCESS'),                     
  OVERLAY=(81:81,8,ZD,SUB,+1,M11,LENGTH=8))                 
  SORT FIELDS=(81,8,CH,A),EQUALS                             
  DUPKEYS SUM=(89,1,ZD)                                     
  OUTFIL INCLUDE=(89,1,ZD,GT,1,AND,9,1,CH,EQ,L(C'2',C'4',C'5'))   
/*                     
Alissa Margulies
Syncsort Mainframe Product Services
201-930-8260
zos_tech@syncsort.com
Alissa Margulies
Global moderator
 
Posts: 369
Joined: Tue Feb 26, 2008 11:15 pm
Location: USA
Has thanked: 1 time
Been thanked: 1 time

Next

Return to Syncsort/Synctool

 


  • Related topics
    Replies
    Views
    Last post