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

How to copy file,based on the condition in the 1st record


IBM Mainframe Forums -> DFSORT/ICETOOL
Post new topic   Reply to topic
View previous topic :: View next topic  
Author Message
Leon

New User


Joined: 11 Nov 2006
Posts: 5

PostPosted: Mon Nov 13, 2006 8:06 pm
Reply with quote

Hi,
I have a flat file, variable length records, different layout for every record. If in the first record the pos,let's say, 10th is equal "Y",- than I need to copy the whole file as is (like the OPTION COPY in sort). If the 10th position is not "Y". I need to bypass all records including the first one, create an empty file. Does someone know, is it possible to accomplish using ICETOOLs?
Thanking in advance.
Back to top
View user's profile Send private message
Frank Yaeger

DFSORT Developer


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

PostPosted: Tue Nov 14, 2006 12:06 am
Reply with quote

Here's a DFSORT/ICETOOL job that will do what you asked for. I assumed your input file has RECFM=VB and LRECL=80, but the job can be changed appropriately for other attributes. I also assumed that when you said the 10th position you were not counting the RDW, so the actual position is 10+4 = 14. If not change 14 to 10.

Code:

//S1 EXEC PGM=ICETOOL
//TOOLMSG DD SYSOUT=*
//DFSMSG DD SYSOUT=*
//IN DD DSN=... input file (VB/80)
//OUT DD DSN=...  output file (VB/80)
//TOOLIN DD *
SPLICE FROM(IN) TO(OUT) ON(5,1,CH) WITHALL WITH(7,77) -
  VLENOVLY KEEPBASE USING(CTL1)
/*
//CTL1CNTL DD *
  INREC BUILD=(1,4,5:C'A',6:14,1,7:5)
  OUTFIL FNAMES=OUT,INCLUDE=(6,1,CH,EQ,C'Y'),
    BUILD=(1,4,5:7)
/*
Back to top
View user's profile Send private message
Leon

New User


Joined: 11 Nov 2006
Posts: 5

PostPosted: Tue Nov 14, 2006 8:05 pm
Reply with quote

When executing your code, got an error:
ICE126A 0 INCONSISTENT *INREC IFTHEN 0 REFORMATTING FIELD FOUND

I understand everything you want to do, except the clause
1,7:5)
in
INREC BUILD=(1,4,5:C'A',6:14,1,7:5)

Why you didn't put:
INREC BUILD=(1,4,5:C'A',6:14,5,76)
Back to top
View user's profile Send private message
Frank Yaeger

DFSORT Developer


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

PostPosted: Tue Nov 14, 2006 9:22 pm
Reply with quote

Leon,

You said "I have a flat file, variable length records". I assumed that meant your input file is VB. So I set up the job to handle VB records. 7:5 at the end of the INREC statement gives us the bytes from 5 to the end of the record. This is the correct way to handle VB records. 5,76 would require that every record have 76 bytes starting at position 5, which may not be the case for VB records.

When I run the job with VB records, it works fine. Given the error message you received, my first guess would be that you really have FB input records rather than VB input records. Is that the case?
Back to top
View user's profile Send private message
Leon

New User


Joined: 11 Nov 2006
Posts: 5

PostPosted: Tue Nov 14, 2006 10:10 pm
Reply with quote

Thanks a lot for your help. You are absolutely right. For VB it was perfectly fine. My file is FB, each record was appended to 750b with spaces.
This is that I have:
//TOOLIN DD *
SPLICE FROM(IN) TO(OUT) ON(1,1,CH) WITHALL WITH(3,750) KEEPBASE - USING(CTL1)
/*
//CTL1CNTL DD *
INREC BUILD=(1:C'A',2:10,1,750)
OUTFIL FNAMES=OUT,INCLUDE=(2,1,CH,EQ,C'Y'),
BUILD=(3,750)

Thanks again.
Back to top
View user's profile Send private message
Leon

New User


Joined: 11 Nov 2006
Posts: 5

PostPosted: Wed Nov 15, 2006 1:00 am
Reply with quote

Hi, Frank,

I modified it and made it with no errors, to:
SPLICE FROM(IN) TO(OUT) ON(751,1,CH) WITHALL WITH(1,750) KEEPBASE -
USING(CTL1)
/*
//CTL1CNTL DD *
INREC BUILD=(1,750,751:C'A')
OUTFIL FNAMES=OUT,INCLUDE=(10,1,CH,EQ,C'Y'),
BUILD=(1,750)

Now it still does NOT work: it includes only the first record...

Thanks again.

Toronto.
Back to top
View user's profile Send private message
Leon

New User


Joined: 11 Nov 2006
Posts: 5

PostPosted: Wed Nov 15, 2006 1:08 am
Reply with quote

And finally it did work, as you showed me:

SPLICE FROM(IN) TO(OUT) ON(751,1,CH) WITHALL WITH(1,750) KEEPBASE -
USING(CTL1)
/*
//CTL1CNTL DD *
INREC BUILD=(1,750,751:C'A',10,1)
OUTFIL FNAMES=OUT,INCLUDE=(752,1,CH,EQ,C'Y'),
BUILD=(1,750)

Thanks a lot for your help again.
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 -> DFSORT/ICETOOL

 


Similar Topics
Topic Forum Replies
No new posts How to split large record length file... DFSORT/ICETOOL 10
No new posts Extracting Variable decimal numbers f... DFSORT/ICETOOL 17
No new posts SFTP Issue - destination file record ... All Other Mainframe Topics 2
No new posts Access to non cataloged VSAM file JCL & VSAM 18
No new posts FINDREP - Only first record from give... DFSORT/ICETOOL 3
Search our Forums:

Back to Top