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 pair or more records.

 
Post new topic   Reply to topic    IBMMAINFRAMES.com Support Forums -> JCL & VSAM
View previous topic :: :: View next topic  
Author Message
ramsri

Active User


Joined: 18 Oct 2008
Posts: 380
Location: India

PostPosted: Wed Jan 21, 2009 6:11 pm    Post subject: Copy pair or more records.
Reply with quote

Hi,

How to copy pair or more of successive records based on first record's criteria?

Input:
Code:

----+----1----+----2
01GM2    DBPGM2EXTR
02GM2    DBPGM23095SDSC2008
03GM2    DBPGM23095SDSC2009
01G9K    TBPG9KEXTR
06G9K    TBPG9K3095SDSC2008
01J16    SKNJ16EXTR
06J16    SKNJ163095SDSC2009
01GM8    DBTGM8EXTR
02GM8    DBTGM83095SDSC2008
01GT8    DBTGT8 XTR
02GT8    DBTGT83095SDSC2009



Output: The criteria to copy is first record should have '01' at 1st column and 16th column should always have values and if the next following record has '02' at starting position then such pair or more of records should be copied to output file.

Code:

01GM2    DBPGM2EXTR
02GM2    DBPGM23095SDSC2008
03GM2    DBPGM23095SDSC2009
01GM8    DBTGM8EXTR
02GM8    DBTGM83095SDSC2008



Please help.
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 Jan 21, 2009 8:09 pm    Post subject: Reply to: Copy pair or more records.
Reply with quote

Hello,

If there is a reason to lock a topic, there is a reason to mention this when locking the topic. . . .

This topic was locked twice for no stated reason.

IMHO, there is nothing questionable about the topic or the manner in which it was posted.

Please refrain from willy-nilly locking. . .

Thank you,

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

Moderator


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

PostPosted: Wed Jan 21, 2009 10:57 pm    Post subject:
Reply with quote

Ramsri,

From whatever you posted, I assume you want to do the below validations.

1. Pos 1-2 has '01' and 16th pos has a non-blank character.
2. If next record has '02' at pos 1-2, copy all the records until the next '01' record.
Back to top
View user's profile Send private message
ramsri

Active User


Joined: 18 Oct 2008
Posts: 380
Location: India

PostPosted: Wed Jan 21, 2009 10:59 pm    Post subject: Reply to: Copy pair or more records.
Reply with quote

Yes Arun. You got it right.
Back to top
View user's profile Send private message
Arun Raj

Moderator


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

PostPosted: Wed Jan 21, 2009 11:50 pm    Post subject:
Reply with quote

Ramsri,

What is the input LRECL/RECFM?
Back to top
View user's profile Send private message
ramsri

Active User


Joined: 18 Oct 2008
Posts: 380
Location: India

PostPosted: Thu Jan 22, 2009 2:47 pm    Post subject: Reply to: Copy pair or more records.
Reply with quote

Hi,

LRECL = 83, RECFM=FB.

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

Moderator


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

PostPosted: Sun Feb 01, 2009 4:18 pm    Post subject:
Reply with quote

Ramsri,

The below SYNCTOOL job should work for your requirement.
Code:
//STEP1    EXEC PGM=SYNCTOOL                                         
//TOOLMSG  DD SYSOUT=*                                               
//DFSMSG   DD SYSOUT=*                                               
//IN       DD DSN= Input  file, FB/LRECL=83                           
//CTL3JNF1 DD DSN=&&T1,DISP=(,PASS),UNIT=SYSDA                       
//CTL3JNF2 DD DSN=&&T2,DISP=(,PASS),UNIT=SYSDA                       
//OUT      DD DSN= Output file, FB/LRECL=83                           
//TOOLIN   DD *                                                       
 SPLICE FROM(IN) TO(CTL3JNF1) ON(92,8,CH) WITHALL WITH(1,83) -       
               KEEPBASE KEEPNODUPS USING(CTL1)                       
 COPY FROM(CTL3JNF1) TO(CTL3JNF2)  USING(CTL2)                       
 SORT FROM(CTL3JNF1) TO(OUT)       USING(CTL3)                       
//CTL1CNTL DD *                                                       
 INREC IFTHEN=(WHEN=INIT,                                             
         OVERLAY=(84:SEQNUM,8,ZD)),                                   
       IFTHEN=(WHEN=(1,2,CH,EQ,C'01'),                               
         OVERLAY=(92:SEQNUM,8,ZD),HIT=NEXT),                         
       IFTHEN=(WHEN=(1,2,CH,EQ,C'01',AND,16,1,CH,NE,C' '),           
         OVERLAY=(100:C'Y')),                                         
       IFTHEN=(WHEN=NONE,                                             
         OVERLAY=(92:SEQNUM,8,ZD,92:84,8,ZD,SUB,92,8,ZD,M11,LENGTH=8))
 OUTFIL INCLUDE=(100,1,CH,EQ,C'Y')                                   
//CTL2CNTL DD *                                         
 INREC OVERLAY=(101:SEQNUM,2,ZD,RESTART=(92,8))         
 OUTFIL INCLUDE=(100,3,CH,EQ,C'Y02',AND,1,2,CH,EQ,C'02'),
        BUILD=(92,8)                                     
//CTL3CNTL DD *                                         
 JOINKEYS FILE=F1,FIELDS=(92,8,A)                       
 JOINKEYS FILE=F2,FIELDS=(01,8,A)                       
 REFORMAT FIELDS=(F1:1,83)                               
 SORT FIELDS=COPY                                       
//*
Back to top
View user's profile Send private message
ramsri

Active User


Joined: 18 Oct 2008
Posts: 380
Location: India

PostPosted: Mon Feb 02, 2009 7:18 pm    Post subject: Reply to: Copy pair or more records.
Reply with quote

Arun, Thank you.

I will try it out today.
Back to top
View user's profile Send private message
ramsri

Active User


Joined: 18 Oct 2008
Posts: 380
Location: India

PostPosted: Mon Feb 02, 2009 11:36 pm    Post subject: Reply to: Copy pair or more records.
Reply with quote

Arun, thanks once again. It has solved my problem.
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 Check if any Detail records and extra... V S Amarendra Reddy SYNCSORT 19 Mon May 08, 2017 8:54 pm
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 Join giving more records than expected Danielle.Filteau SYNCSORT 2 Thu Mar 09, 2017 3:28 am
No new posts TSO or command line utility to genera... kishpra JCL & VSAM 3 Thu Mar 09, 2017 1:11 am


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