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
 

 

Building BIND Statement from input records

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

New User


Joined: 15 Oct 2007
Posts: 12
Location: Kentucky

PostPosted: Fri Apr 06, 2012 6:30 pm    Post subject: Building BIND Statement from input records
Reply with quote

I'm trying to build a bind statement (Output).

Input Records delimited by Comma -1 row heading for reference only. data doesnt have 1st row.
PACKAGE,MEMBER,LIBRARY,OWNER,QUALIFIER,REPLVER
PRODEH,CLMADJ,ABC.AA.XYZ.XXX,SCOTT,DB2T1A,2011-01-01-12.34.56.123456
PRODEH,CLMPAYBL,ABC.AA.XYZ.YYY,WILSON,DB2T1A,2012-01-01-12.34.56.123456

where PACKAGE is fixed length =6
MEMBER variable length 5 to 8 (max)
LIBRARY fixed length =14
OWNER variable length 5 to 8 (max)
QUALIFIER - 6 length (Fixed)
REPLVER - 26 char fixed

Output Required
DSN SYSTEM(PROD)
BIND PACKAGE(PRODEH)+
MEMBER(CLMADJ) LIBRARY('ABC.AA.XYZ.XXX')+
OWNER(WILSON) QUALIFIER(DB2T1A)+
SQLERROR(NOPACKAGE) DEFER(PREPARE)+
VALIDATE(BIND) FLAG(I)+
ISOLATION(CS) CURRENTDATA(NO)
DEGREE(ANY) RELEASE(DEALLOCATE)+
EXPLAIN(YES) DYNAMICRULES(BIND)+
NOREOPT(VARS) KEEPDYNAMIC(NO)+
ENCODING(37)+
ACTION(REPLACE) REPLVER(2011-01-01-12.34.56.123456)
END
EXIT CODE(&LASTCC)
END

DSN SYSTEM(PROD)
BIND PACKAGE(PRODEH)+
MEMBER(CLMPAYBL) LIBRARY('ABC.AA.XYZ.YYY')+
OWNER(SCOTT) QUALIFIER(DB2T1A)+
SQLERROR(NOPACKAGE) DEFER(PREPARE)+
VALIDATE(BIND) FLAG(I)+
ISOLATION(CS) CURRENTDATA(NO)
DEGREE(ANY) RELEASE(DEALLOCATE)+
EXPLAIN(YES) DYNAMICRULES(BIND)+
NOREOPT(VARS) KEEPDYNAMIC(NO)+
ENCODING(37)+
ACTION(REPLACE) REPLVER(2012-01-01-12.34.56.123456)
END
EXIT CODE(&LASTCC)
END

Following output records comes from input. Rest all are hardcode.
PACKAGE
MEMBER
LIBRARY
OWNER
QUALIFIER
REPLVER

For Output record the 2nd column like LIBRARY,QUALIFIER,DEFER,FLAG etc can be started from position 25.
Max length of output record is 72.
Any help is appreciated !
Back to top
View user's profile Send private message

enrico-sorichetti

Global Moderator


Joined: 14 Mar 2007
Posts: 10202
Location: italy

PostPosted: Fri Apr 06, 2012 6:42 pm    Post subject: Reply to: Building BIND Statement from input records
Reply with quote

why not try Yourself, the requirement is pretty similar to this one
http://www.ibmmainframes.com/viewtopic.php?t=56189&highlight=
that You posted Yourself and for which You received a solution
the logic of which can be applied to the problem in this topic.
Back to top
View user's profile Send private message
sarbamrit

New User


Joined: 15 Oct 2007
Posts: 12
Location: Kentucky

PostPosted: Fri Apr 06, 2012 7:58 pm    Post subject: Re: Reply to: Building BIND Statement from input records
Reply with quote

enrico-sorichetti wrote:
why not try Yourself, the requirement is pretty similar to this one
http://www.ibmmainframes.com/viewtopic.php?t=56189&highlight=
that You posted Yourself and for which You received a solution
the logic of which can be applied to the problem in this topic.


Hi Enrico,

Yes i did have a look at my previous solution. BUt I'm unable to unstring it. Reason: Input has comma delimited and position varies for different parameters based on other values. So I'm not sure how to get out of it.
Back to top
View user's profile Send private message
Bill Woodger

DFSORT Moderator


Joined: 09 Mar 2011
Posts: 7234

PostPosted: Fri Apr 06, 2012 8:08 pm    Post subject: Reply to: Building BIND Statement from input records
Reply with quote

That's what PARSE is for. Lots of examples.
Back to top
View user's profile Send private message
daveporcelan

Active Member


Joined: 01 Dec 2006
Posts: 645
Location: Pennsylvania

PostPosted: Fri Apr 06, 2012 8:12 pm    Post subject:
Reply with quote

Amrit,

I am sure Frank or Kolusu will bail you out with a solution.

If they do not do your work for you, I am available to do so.

I have written a Rexx solution for this exact situation.

That code belongs to my cleint as they paid me to write it.

I can however write you custom code for your circumstances.

I work at a very reasonable rate of 500 dollars for a eight hour day.

Feel free to send me a PM so we can work out the details.
Back to top
View user's profile Send private message
sarbamrit

New User


Joined: 15 Oct 2007
Posts: 12
Location: Kentucky

PostPosted: Fri Apr 06, 2012 8:18 pm    Post subject: Re: Reply to: Building BIND Statement from input records
Reply with quote

Bill Woodger wrote:
That's what PARSE is for. Lots of examples.


I thought abt PARSE also, but some of input records are of variable length and for PARSE command we need to provide FIXLEN or other which is not my case.
Back to top
View user's profile Send private message
Bill Woodger

DFSORT Moderator


Joined: 09 Mar 2011
Posts: 7234

PostPosted: Fri Apr 06, 2012 8:42 pm    Post subject: Reply to: Building BIND Statement from input records
Reply with quote

The FIXLEN is for the maximum length of a field. All PARSEd fields are fixed length. Each value in the field will be the same size, some will be padded with trailing space.

Code:
A,12345,B
A,1234567,B

If you PARSE ending at the commas and with FIXLENs of 1, 7 and 1 you will get

Code:
A12345  B
A1234567B
Back to top
View user's profile Send private message
dbzTHEdinosauer

Global Moderator


Joined: 20 Oct 2006
Posts: 6966
Location: porcelain throne

PostPosted: Fri Apr 06, 2012 8:46 pm    Post subject:
Reply with quote

sarbamrit wrote:
I thought abt PARSE also

stop thinking about it and read about it.
there are parameters that you can use, so that
  1. avoid using fix position notation
  2. allow for variable length records


of course you could always search the board
(lotta effort, i know
but today's Good Friday in the states
and i imagine Frank and Kolusu are taking a much deserved break.)
Back to top
View user's profile Send private message
sarbamrit

New User


Joined: 15 Oct 2007
Posts: 12
Location: Kentucky

PostPosted: Fri Apr 06, 2012 8:49 pm    Post subject: Re: Reply to: Building BIND Statement from input records
Reply with quote

Bill Woodger wrote:
The FIXLEN is for the maximum length of a field. All PARSEd fields are fixed length. Each value in the field will be the same size, some will be padded with trailing space.

Code:
A,12345,B
A,1234567,B

If you PARSE ending at the commas and with FIXLENs of 1, 7 and 1 you will get

Code:
A12345  B
A1234567B


Yes.
My case is say in case of MEMBER(ABC123). I can also have MEMBER(ABC1234) or MEMBER(ABC12345). The issue of NOT using PARSE is FIXLEN need to be provided.
Code:
MEMBER(ABC123)
will become
Code:
MEMBER(ABC123  )
Code:
MEMBER(ABC1234)
will become
Code:
MEMBER(ABC1234 )
Code:
MEMBER(ABC12345)
will become
Code:
MEMBER(ABC12345)
whereas I dont want any spaces before my closing bracket.

I'm not sure how to achieve this using PARSE.
Back to top
View user's profile Send private message
Bill Woodger

DFSORT Moderator


Joined: 09 Mar 2011
Posts: 7234

PostPosted: Fri Apr 06, 2012 9:06 pm    Post subject: Reply to: Building BIND Statement from input records
Reply with quote

Do you remember being directed to your previous post? For getting rid of the spaces afterwards, you have things like JFY and SQZ.

If you want to "decode" your comma-delimited fields with DFSORT, you are going to use PARSE.

For getting rid of the spaces after you have formatted your commands, you use different functions.
Back to top
View user's profile Send private message
Skolusu

Senior Member


Joined: 07 Dec 2007
Posts: 2205
Location: San Jose

PostPosted: Fri Apr 06, 2012 10:05 pm    Post subject:
Reply with quote

sarbamrit,

You are building BIND cards and the parameters can be on different lines , you don't have to club parameters on to a single line. The output file should be 80 bytes and not 72 bytes. Use the following DFSORT JCL
Code:

//STEP0100 EXEC PGM=SORT                                               
//SYSOUT   DD SYSOUT=*                                                 
//SORTIN   DD *                                                         
PRODEH,CLMADJ,ABC.AA.XYZ.XXX,SCOTT,DB2T1A,2011-01-01-12.34.56.123456   
PRODEH,CLMPAYBL,ABC.AA.XYZ.YYY,WILSON,DB2T1A,2012-01-01-12.34.56.123456
//SORTOUT  DD SYSOUT=*                                                 
//SYSIN    DD *                                                 
  SORT FIELDS=COPY                                             
  INREC PARSE=(%01=(ENDBEFR=C',',FIXLEN=06),                   
               %02=(ENDBEFR=C',',FIXLEN=08),                   
               %03=(ENDBEFR=C',',FIXLEN=14),                   
               %04=(ENDBEFR=C',',FIXLEN=08),                   
               %05=(ENDBEFR=C',',FIXLEN=06),                   
               %06=(ENDBEFR=C',',FIXLEN=26)),                   
  BUILD=(%01,SQZ=(SHIFT=LEFT,LENGTH=80,                         
                  LEAD=C'BIND PACKAGE(',TRAIL=C') +'),         
         %02,SQZ=(SHIFT=LEFT,LENGTH=80,                         
                  LEAD=C'MEMBER(',TRAIL=C') +'),               
         %03,SQZ=(SHIFT=LEFT,LENGTH=80,                         
                  LEAD=C'LIBRARY(',TRAIL=C') +'),               
         %04,SQZ=(SHIFT=LEFT,LENGTH=80,                         
                  LEAD=C'OWNER(',TRAIL=C') +'),                 
         %05,SQZ=(SHIFT=LEFT,LENGTH=80,                         
                  LEAD=C'QUALIFIER(',TRAIL=C') +'),             
         %06,SQZ=(SHIFT=LEFT,LENGTH=80,                         
                  LEAD=C'ACTION(REPLACE) REPLVER(',TRAIL=C')'))
                                                               
  OUTFIL BUILD=(C'DSN SYSTEM(PROD)',/,                         
                001,80,/,081,80,/,161,80,/,241,80,/,321,80,/,   
                C'SQLERROR(NOPACKAGE) DEFER(PREPARE)  +',/,     
                C'VALIDATE(BIND) FLAG(I)              +',/,     
                C'ISOLATION(CS) CURRENTDATA(NO)       +',/,     
                C'DEGREE(ANY) RELEASE(DEALLOCATE)     +',/,     
                C'EXPLAIN(YES) DYNAMICRULES(BIND)     +',/,     
                C'NOREOPT(VARS) KEEPDYNAMIC(NO)       +',/,     
                C'ENCODING(37)                        +',/,     
                401,80,/,                                       
                C'END',/,                                       
                C'EXIT CODE(&LASTCC)',/,                       
                C'END',/,80:X)                                 
//*


This will produce the following Output
Code:

DSN SYSTEM(PROD)                                       
BIND PACKAGE(PRODEH) +                                 
MEMBER(CLMADJ) +                                       
LIBRARY(ABC.AA.XYZ.XXX) +                             
OWNER(SCOTT) +                                         
QUALIFIER(DB2T1A) +                                   
SQLERROR(NOPACKAGE) DEFER(PREPARE)  +                 
VALIDATE(BIND) FLAG(I)              +                 
ISOLATION(CS) CURRENTDATA(NO)       +                 
DEGREE(ANY) RELEASE(DEALLOCATE)     +                 
EXPLAIN(YES) DYNAMICRULES(BIND)     +                 
NOREOPT(VARS) KEEPDYNAMIC(NO)       +                 
ENCODING(37)                        +                 
ACTION(REPLACE) REPLVER(2011-01-01-12.34.56.123456)   
END                                                   
EXIT CODE(&LASTCC)                                     
END                                                   
                                                       
DSN SYSTEM(PROD)                                       
BIND PACKAGE(PRODEH) +                                 
MEMBER(CLMPAYBL) +                                     
LIBRARY(ABC.AA.XYZ.YYY) +                             
OWNER(WILSON) +                                       
QUALIFIER(DB2T1A) +                                   
SQLERROR(NOPACKAGE) DEFER(PREPARE)  +                 
VALIDATE(BIND) FLAG(I)              +                 
ISOLATION(CS) CURRENTDATA(NO)       +                 
DEGREE(ANY) RELEASE(DEALLOCATE)     +                 
EXPLAIN(YES) DYNAMICRULES(BIND)     +                 
NOREOPT(VARS) KEEPDYNAMIC(NO)       +                 
ENCODING(37)                        +                 
ACTION(REPLACE) REPLVER(2012-01-01-12.34.56.123456)   
END                                                   
EXIT CODE(&LASTCC)                                     
END                                                   
                                                       
Back to top
View user's profile Send private message
sarbamrit

New User


Joined: 15 Oct 2007
Posts: 12
Location: Kentucky

PostPosted: Mon Apr 09, 2012 3:23 pm    Post subject: Thank you
Reply with quote

Thank you Kolusu for the complete solution.
I would also like to say 'Thank you' to Enrico, Bill and Dick for putting their time in guiding and providing solutions.
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 Removing Duplicates based on certain ... chandracdac DFSORT/ICETOOL 1 Fri Dec 09, 2016 4:40 am
No new posts Performing arithmetic on input field zh_lad DFSORT/ICETOOL 22 Tue Dec 06, 2016 8:04 pm
No new posts High CPU consumption Job using IAM fi... aswinir JCL & VSAM 8 Thu Dec 01, 2016 8:28 pm
No new posts Limit duplicate records in the SORT pshongal SYNCSORT 6 Mon Nov 21, 2016 12:54 pm
No new posts -913/-911 Deadlock during UPDATE stat... NoSleep319 DB2 5 Fri Nov 18, 2016 12:37 am


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