Portal | Manuals | References | Downloads | Info | Programs | JCLs | Mainframe wiki | Quick Ref
IBM Mainframe Computers Forums Index
 
Register
 
IBM Mainframe Computers Forums Index Mainframe: Search IBM Mainframe Forum: FAQ Memberlist 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: 2285
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: 2285
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: 2285
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 Copy 4 byte of data from the last rec... arunsoods DFSORT/ICETOOL 9 Fri Oct 06, 2017 12:15 pm
No new posts sort records based on length exceeds ... maxsubrat DFSORT/ICETOOL 7 Wed Oct 04, 2017 4:48 pm
No new posts Addition of two records on 2 fields amar143 SYNCSORT 8 Tue Oct 03, 2017 11:14 am
No new posts XMITIP sends it out. Can it copy on l... Rommel Dayon Rustia IBM Tools 0 Tue Sep 05, 2017 10:16 am
No new posts Join records from 2 files with No Dup... Poha Eater DFSORT/ICETOOL 22 Sun Aug 27, 2017 10:35 pm

Facebook
Back to Top
 
Job Vacancies | Forum Rules | Bookmarks | Subscriptions | FAQ | Polls | Contact Us