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

Copy sequence of rows when a condition is met


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

New User


Joined: 03 Nov 2008
Posts: 60

PostPosted: Tue Mar 09, 2010 4:19 pm
Reply with quote

I use SYNCSORT FOR Z/OS 1.3.2.1R

I want to copy rows that has

1. Character 'MEMBER' - position is 32
2. All following line should have character 'FILE' - position is random

Sample input (length 80, format FB)

Code:
I35AFESS                       MEMBER                     
I35AFLAN                       MEMBER                     
I3500A                         MEMBER                     
   105      FDEMGSE FILE OUTPUT RECORD;                   
I3500B                         MEMBER                     
   105          FDOCBE               FILE INPUT RECORD ; 
I3500K1                        MEMBER                     
    65          FDOCBE               FILE INPUT  RECORD ;
    66          FTRTCC               FILE OUTPUT RECORD ;
I3513B                         MEMBER                     
I3513C1                        MEMBER                     
    65      FSTOCK1 FILE RECORD OUTPUT;                   
I3513C2                        MEMBER                     
    44          FEDIT                  FILE OUTPUT RECOR 
   257      FSTOCK2 FILE RECORD INPUT;                   
   275      FBAC2    FILE RECORD INPUT;                   
   292      FALVST2    FILE RECORD INPUT;                 
   308      FMEUBL2    FILE RECORD INPUT;                 
I3515F                         MEMBER                     
I3515FH                        MEMBER                     
I3515G                         MEMBER                     
I3515H1                        MEMBER                     
    96          FRETLNC                  FILE OUTPUT RECO



Sample output

Code:
I3500A                         MEMBER                     
   105      FDEMGSE FILE OUTPUT RECORD;                   
I3500B                         MEMBER                     
   105          FDOCBE               FILE INPUT RECORD ; 
I3500K1                        MEMBER                     
    65          FDOCBE               FILE INPUT  RECORD ;
    66          FTRTCC               FILE OUTPUT RECORD ;
I3513C1                        MEMBER                     
    65      FSTOCK1 FILE RECORD OUTPUT;                   
I3513C2                        MEMBER                     
    44          FEDIT                  FILE OUTPUT RECOR 
   257      FSTOCK2 FILE RECORD INPUT;                   
   275      FBAC2    FILE RECORD INPUT;                   
   292      FALVST2    FILE RECORD INPUT;                 
   308      FMEUBL2    FILE RECORD INPUT;                 
I3515H1                        MEMBER                     
    96          FRETLNC                  FILE OUTPUT RECO


Thanks
Back to top
View user's profile Send private message
Arun Raj

Moderator


Joined: 17 Oct 2006
Posts: 2481
Location: @my desk

PostPosted: Tue Mar 09, 2010 5:11 pm
Reply with quote

Quote:
All following line should have character 'FILE' - position is random
What if you have multiple lines out of which one line is not having 'FILE' in any position? Is there any such possiblity?
Back to top
View user's profile Send private message
km_abdullah

New User


Joined: 03 Nov 2008
Posts: 60

PostPosted: Tue Mar 09, 2010 5:21 pm
Reply with quote

No, all the 'Non-MEMBER' lines following 'MEMBER line' will have character 'FILE' in some location.
Back to top
View user's profile Send private message
Arun Raj

Moderator


Joined: 17 Oct 2006
Posts: 2481
Location: @my desk

PostPosted: Wed Mar 10, 2010 1:10 pm
Reply with quote

km_abdullah,

Here's one way of achieving the same using SYNCTOOL.
Code:
//STEP0100 EXEC PGM=SYNCTOOL                                         
//IN       DD DSN= Input file  (FB/80)                               
//OUT      DD DSN= Output file (FB/80)                               
//TOOLMSG  DD SYSOUT=*                                               
//DFSMSG   DD SYSOUT=*                                               
//TOOLIN   DD *                                                       
 SELECT FROM(IN) TO(OUT) ON(81,8,CH) ALLDUPS USING(CTL1)             
//CTL1CNTL DD *                                                       
 SORT FIELDS=COPY                                                     
 INREC IFTHEN=(WHEN=GROUP,BEGIN=(32,6,CH,EQ,C'MEMBER'),PUSH=(81:ID=8))
 OUTFIL BUILD=(1,80)   
Back to top
View user's profile Send private message
km_abdullah

New User


Joined: 03 Nov 2008
Posts: 60

PostPosted: Wed Mar 10, 2010 3:17 pm
Reply with quote

Thanks, it works wonders!
Back to top
View user's profile Send private message
km_abdullah

New User


Joined: 03 Nov 2008
Posts: 60

PostPosted: Wed Mar 10, 2010 3:34 pm
Reply with quote

Hi Arun,

I noticed that DFSMSG shows message "POTENTIALLY INEFFICIENT USE OF INREC". Is there any reason for this?

Code:
WER108I  IN       : RECFM=FB   ; LRECL=    80; BLKSIZE=    80                 
WER257I  INREC RECORD LENGTH =    88                                         
WER238I  POTENTIALLY INEFFICIENT USE OF INREC                                 
WER110I  OUT      : RECFM=FB   ; LRECL=    80; BLKSIZE=    80                 
WER055I  INSERT          6, DELETE         12                                 
WER405I  OUT      :  DATA RECORDS OUT         17; TOTAL RECORDS OUT         17
WER449I  SYNCSORT GLOBAL DSM SUBSYSTEM ACTIVE                                 
WER054I  RCD IN         23, OUT         17                                   
WER169I  RELEASE 1.3 BATCH 0506 TPF LEVEL 2.1   
Back to top
View user's profile Send private message
Arun Raj

Moderator


Joined: 17 Oct 2006
Posts: 2481
Location: @my desk

PostPosted: Wed Mar 10, 2010 4:19 pm
Reply with quote

You're welcome. WER238I is just a warning message since the INREC statement has increased the input record length here.
Back to top
View user's profile Send private message
Marso

REXX Moderator


Joined: 13 Mar 2006
Posts: 1353
Location: Israel

PostPosted: Wed Mar 10, 2010 4:23 pm
Reply with quote

We use SYNCSORT version 1.3.0.0RI, and the WHEN=GROUP gave me a syntax error.
The documentation tells only about WHEN=INIT or ANY or NONE or (conditions).

Apparently this is a really really new feature!
Back to top
View user's profile Send private message
km_abdullah

New User


Joined: 03 Nov 2008
Posts: 60

PostPosted: Wed Mar 10, 2010 4:35 pm
Reply with quote

Oh! I thought my site is using very old version (1.3.2.1RI, 2007)

DFSMSG
Code:

SYNCSORT FOR Z/OS  1.3.2.1RI   U.S. PATENTS:    (C) 2007 SYNCSORT INC.   DATE=2010/069   TIME=11.00.13
                                                      z/OS   1.10.0           



Do we have some more features in the latest release of SYNCSORT?
Back to top
View user's profile Send private message
Arun Raj

Moderator


Joined: 17 Oct 2006
Posts: 2481
Location: @my desk

PostPosted: Wed Mar 10, 2010 8:33 pm
Reply with quote

Quote:
I thought my site is using very old version
No..You are lucky enough to have the recent one. To know about other features in this release check out the Syncsort manual. If you dont have one, get it from Syncsort support/PM Alissa(JCL Moderator). They'll help you in getting one soon.
Back to top
View user's profile Send private message
dick scherrer

Moderator Emeritus


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

PostPosted: Wed Mar 10, 2010 8:39 pm
Reply with quote

Hello,

1.3.0 is a bit older.

1.3.2 is current (unless i missed some memo. . .).
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 To get the count of rows for every 1 ... DB2 3
No new posts VB to VB copy - Full length reached SYNCSORT 8
No new posts Exclude rows with > than x occurre... DFSORT/ICETOOL 6
No new posts Need COBOL COPY Help in MVS Environment COBOL Programming 4
No new posts Cobol program with sequence number ra... COBOL Programming 5
Search our Forums:

Back to Top