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
 
How to copy file,based on the condition in the 1st record

 
Post new topic   Reply to topic    IBMMAINFRAMES.com Support Forums -> DFSORT/ICETOOL
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    Post subject: How to copy file,based on the condition in the 1st record
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 Moderator


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

PostPosted: Tue Nov 14, 2006 12:06 am    Post subject:
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    Post subject:
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 Moderator


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

PostPosted: Tue Nov 14, 2006 9:22 pm    Post subject:
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    Post subject:
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    Post subject:
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    Post subject:
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    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 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 Execute JCL step based on the content... sprikitik JCL & VSAM 2 Tue Oct 03, 2017 10:03 am
This topic is locked: you cannot edit posts or make replies. PS file data should be passed as symb... d_sarlie JCL & VSAM 15 Tue Oct 03, 2017 5:18 am
No new posts How to insert a value on specific pos... Poha Eater DFSORT/ICETOOL 9 Sun Oct 01, 2017 3:04 am

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