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
 

 

Copy sequence of rows when a condition is met

 
Post new topic   Reply to topic    IBMMAINFRAMES.com Support Forums -> JCL & VSAM
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    Post subject: Copy sequence of rows when a condition is met
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: 2284
Location: @my desk

PostPosted: Tue Mar 09, 2010 5:11 pm    Post subject:
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    Post subject:
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: 2284
Location: @my desk

PostPosted: Wed Mar 10, 2010 1:10 pm    Post subject:
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    Post subject:
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    Post subject:
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: 2284
Location: @my desk

PostPosted: Wed Mar 10, 2010 4:19 pm    Post subject:
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: 1232
Location: Israel

PostPosted: Wed Mar 10, 2010 4:23 pm    Post subject: Reply to: Copy sequence of rows when a condition is met
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    Post subject:
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: 2284
Location: @my desk

PostPosted: Wed Mar 10, 2010 8:33 pm    Post subject:
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

Site Director


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

PostPosted: Wed Mar 10, 2010 8:39 pm    Post subject:
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    IBMMAINFRAMES.com Support Forums -> JCL & VSAM All times are GMT + 6 Hours
Page 1 of 1

 

Search our Forum:

Similar Topics
Topic Author Forum Replies Posted
No new posts compare 2 rows within the same file ram_vizag SYNCSORT 7 Wed Jun 14, 2017 12:34 am
This topic is locked: you cannot edit posts or make replies. Need help on If condition continuatio... ashok_uddaraju CLIST & REXX 4 Fri May 19, 2017 8:55 am
No new posts copy SEQ to PDS and create stats steve-myers JCL & VSAM 7 Thu Apr 27, 2017 1:15 am
No new posts Copy load modules and alias vasanthz IBM Tools 5 Thu Apr 20, 2017 6:31 am
No new posts To display values of multiple rows in... vinu78 DB2 2 Thu Mar 09, 2017 1:20 pm


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