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 based on value in trailer

 
Post new topic   Reply to topic    IBMMAINFRAMES.com Support Forums -> DFSORT/ICETOOL
View previous topic :: :: View next topic  
Author Message
karisurya

New User


Joined: 02 Aug 2007
Posts: 64
Location: Bangalore

PostPosted: Thu Mar 26, 2009 12:45 pm    Post subject: Copy based on value in trailer
Reply with quote

Hi,
I have around 10 gdg's. I need to concatinate using sort under following condition.

All of my files will have a header and trailer record.I need to skip copying file if trailer records contain total record count as 0000.

Can any one please suggest possible way to copy data set using sort only if trailer record contains value >0 at a specific position.

Please let me know in case if you have any questions.

Thanks,
Surya
Back to top
View user's profile Send private message

bipinpeter

Active User


Joined: 18 Jun 2007
Posts: 208
Location: Cochin/Kerala/India

PostPosted: Thu Mar 26, 2009 1:07 pm    Post subject:
Reply with quote

Hi karisurya,
can you post the record format of your files?.
Back to top
View user's profile Send private message
karisurya

New User


Joined: 02 Aug 2007
Posts: 64
Location: Bangalore

PostPosted: Thu Mar 26, 2009 1:12 pm    Post subject:
Reply with quote

The trailer record looks some thing like below,

TRAILERWBO22020NMB07 ONT1NMB0710 20090324001763000000571

The last 6 digits represents the no of records in the generation. In this case i have 571 records.

I need to copy the data from this file to a new file only if this value is greater than 0.

Thanks,
Surya
Back to top
View user's profile Send private message
Frank Yaeger

DFSORT Moderator


Joined: 15 Feb 2005
Posts: 7130
Location: San Jose, CA

PostPosted: Thu Mar 26, 2009 9:16 pm    Post subject:
Reply with quote

Quote:
I need to copy the data from this file to a new file only if this value is greater than 0.


Here's a DFSORT/ICETOOL job that will copy IN to OUT only if IN has a TRAILER record with a count greater than 0. Otherwise the job will terminate with RC=12 and the file will NOT be copied.


Code:

//S1   EXEC  PGM=ICETOOL
//TOOLMSG   DD  SYSOUT=*
//DFSMSG    DD  SYSOUT=*
//IN DD *
...
RECORD
RECORD
TRAILERWBO22020NMB07   ONT1NMB0710 20090324001763000000000
/*
//OUT DD DSN=...  output file
//TOOLIN DD *
COUNT FROM(IN) USING(CTL1) EMPTY
COPY FROM(IN) TO(OUT)
/*
//CTL1CNTL DD *
  INCLUDE COND=(1,7,CH,EQ,C'TRAILER',AND,50,9,ZD,GT,0)
/*


Quote:
I have around 10 gdg's. I need to concatinate using sort under following condition.

All of my files will have a header and trailer record.I need to skip copying file if trailer records contain total record count as 0000.


It's not clear what you mean by this. If you need more help with it, please show an example of the records in your input files and what you expect for output, and explain the "rules" for getting from input to output.
Also give the RECFM and LRECL of the input files, and the starting position, length and format of all relevant fields (e.g. the 'TRAILER' identifier and the count field).
Back to top
View user's profile Send private message
karisurya

New User


Joined: 02 Aug 2007
Posts: 64
Location: Bangalore

PostPosted: Mon Mar 30, 2009 5:14 pm    Post subject:
Reply with quote

Hi Frank,
Your reply solved part of my problem, let me give you more details
I have a job which takes following input

//XYZ0601 DD DSN=TSTS.COBIWBO.WB22020A(+0),DISP=SHR
// DD DSN=TSTS.COBIWBO.WB22020B(+0),DISP=SHR
// DD DSN=TSTS.COBIWBO.WB22020C(+0),DISP=SHR
// DD DSN=TSTS.COBIWBO.WB22020D(+0),DISP=SHR
// DD DSN=TSTS.COBIWBO.WB22020E(+0),DISP=SHR
// DD DSN=TSTS.COBIWBO.WB22020F(+0),DISP=SHR
// DD DSN=TSTS.COBIWBO.WB22020G(+0),DISP=SHR
// DD DSN=TSTS.COBIWBO.WB22020H(+0),DISP=SHR
// DD DSN=TSTS.COBIWBO.WB22020I(+0),DISP=SHR
// DD DSN=TSTS.COBIWBO.WB22020J(+0),DISP=SHR

The record type is as follows
Record format . . . : VB
Record length . . . : 579


The problem is if any of the above generations is having only header and trailer record the job gets abended (i.e., The trailer record contains 000000 as no of records). I have manually browse each of latest generation for above gdg's and if its empty comment it out in job manually.

Now i want to add a step before this using ICETOOL to do this check automatically and create a file which i can use here as input in this step. I am just trying to put a condition in sort which will copy data from current generation to new output file only if trailer record contains value >0. This chekking has to be done to all the above generations and there will be a single output merge file which i can use as input to current step.

I hope i am clear please let me know in case if you have any questions

Here are sample HEADER,DETAIL,TRAILER RECORDS

HEADER WBO22020NMB07 ONT1XYZ0710 20090327001764
30028195442009033000551711000007600 *******************
TRAILERWBO22020NMB07 ONT1XYZ0710 20090327001764000000001

The last 6 digits in trailer repoesents no of records in that generation.

If you have any other good alternatvies to my problem please do suggest.

Thanks,
Surya
Back to top
View user's profile Send private message
Garry Carroll

Active Member


Joined: 08 May 2006
Posts: 991
Location: Dublin, Ireland / Edinburgh, Scotland

PostPosted: Mon Mar 30, 2009 6:28 pm    Post subject:
Reply with quote

Wouldn't it be as easy to first delete/create your output file with IEFBR14 steps with DISP=(MOD,DELETE,DELETE) and then DISP=(,CALTG). Next, run Frank's step for each of your GDGs using DISP=MOD ?

This would result in concatenating all files where trailer count > 0.

Garry.
Back to top
View user's profile Send private message
karisurya

New User


Joined: 02 Aug 2007
Posts: 64
Location: Bangalore

PostPosted: Mon Mar 30, 2009 6:40 pm    Post subject:
Reply with quote

Hi Garry,

Thank you for the reply, Presently thats what i am planning to do. The only problem i see in this approach is i need to have 9 steps seperately for all the gdg's.
I am checking if there are any other better solutions to this problem or some how i can reduce the amount of code in this solution?

Thanks,
Surya
Back to top
View user's profile Send private message
Garry Carroll

Active Member


Joined: 08 May 2006
Posts: 991
Location: Dublin, Ireland / Edinburgh, Scotland

PostPosted: Mon Mar 30, 2009 7:01 pm    Post subject:
Reply with quote

Quote:
how i can reduce the amount of code in this solution


I doubt you can reduce the amount of code. Frank has used just 3 lines which can be saved in 2 datasets (or 2 PDS members). All that needs to change from step to step is the DSN and you could maybe use variable substitution in a procedure to reduce the coding of this.

Garry.[/code]
Back to top
View user's profile Send private message
Frank Yaeger

DFSORT Moderator


Joined: 15 Feb 2005
Posts: 7130
Location: San Jose, CA

PostPosted: Mon Mar 30, 2009 10:22 pm    Post subject:
Reply with quote

Here's a DFSORT/ICETOOL job that will "skip copying file if trailer records contain total record count as 0000".

Code:

//S1   EXEC  PGM=ICETOOL
//TOOLMSG   DD  SYSOUT=*
//DFSMSG    DD  SYSOUT=*
//CON DD DSN=TSTS.COBIWBO.WB22020A(+0),DISP=SHR
// DD DSN=TSTS.COBIWBO.WB22020B(+0),DISP=SHR
// DD DSN=TSTS.COBIWBO.WB22020C(+0),DISP=SHR
// DD DSN=TSTS.COBIWBO.WB22020D(+0),DISP=SHR
// DD DSN=TSTS.COBIWBO.WB22020E(+0),DISP=SHR
// DD DSN=TSTS.COBIWBO.WB22020F(+0),DISP=SHR
// DD DSN=TSTS.COBIWBO.WB22020G(+0),DISP=SHR
// DD DSN=TSTS.COBIWBO.WB22020H(+0),DISP=SHR
// DD DSN=TSTS.COBIWBO.WB22020I(+0),DISP=SHR
// DD DSN=TSTS.COBIWBO.WB22020J(+0),DISP=SHR
//T1 DD DSN=&&T1,UNIT=SYSDA,SPACE=(CYL,(5,5)),DISP=(,PASS)
//CTL2CNTL DD DSN=&&C1,UNIT=SYSDA,SPACE=(TRK,(1,1)),DISP=(,PASS)
//OUT DD DSN=...  output file (VB/579)
//TOOLIN DD *
COPY FROM(CON) USING(CTL1)
COPY FROM(T1) USING(CTL2)
/*
//CTL1CNTL DD *
  OPTION VLSCMP
  INREC IFTHEN=(WHEN=INIT,BUILD=(1,4,7:5)),
    IFTHEN=(WHEN=GROUP,BEGIN=(7,6,CH,EQ,C'HEADER'),
      PUSH=(5:ID=2))
  OUTFIL FNAMES=T1
  OUTFIL FNAMES=CTL2CNTL,VTOF,REMOVECC,
    INCLUDE=(7,7,CH,EQ,C'TRAILER',AND,56,9,ZD,GT,0),
    HEADER1=('  INCLUDE FORMAT=ZD,COND=(1,1,NE,1,1,OR,'),
    BUILD=(C'   5,2,EQ,',5,2,C',OR,',80:X),
    TRAILER1=('   1,1,NE,1,1)',/,
    '  OUTFIL FNAMES=OUT,BUILD=(1,4,5:7) ')
/*
Back to top
View user's profile Send private message
karisurya

New User


Joined: 02 Aug 2007
Posts: 64
Location: Bangalore

PostPosted: Tue Mar 31, 2009 2:45 pm    Post subject:
Reply with quote

Frank,

Thank you very much for a very quick and best solution to the given problem.

Regards,
Surya
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 -> DFSORT/ICETOOL All times are GMT + 6 Hours
Page 1 of 1

 

Search our Forum:

Similar Topics
Topic Author Forum Replies Posted
No new posts SORTJOIN - Copy Matched and Unmatched... Steve Ironmonger DFSORT/ICETOOL 5 Tue Jan 17, 2017 4:26 pm
No new posts HALDB data refresh/copy from producti... vineetanand2007 IMS DB/DC 0 Mon Jan 02, 2017 11:16 am
No new posts Copy RECFM =VB TO FB file with RECL =... sahil41352 DFSORT/ICETOOL 3 Wed Dec 28, 2016 11:29 pm
No new posts Removing Duplicates based on certain ... chandracdac DFSORT/ICETOOL 8 Fri Dec 09, 2016 4:40 am
No new posts syncsort: copy lines after the keyword shreya19 SYNCSORT 7 Fri Dec 02, 2016 9:47 am


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