|
View previous topic :: View next topic
|
| Author |
Message |
sarbamrit
New User
Joined: 15 Oct 2007 Posts: 12 Location: Kentucky
|
|
|
|
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 |
|
 |
enrico-sorichetti
Superior Member

Joined: 14 Mar 2007 Posts: 10903 Location: italy
|
|
| Back to top |
|
 |
sarbamrit
New User
Joined: 15 Oct 2007 Posts: 12 Location: Kentucky
|
|
|
|
| enrico-sorichetti wrote: |
why not try Yourself, the requirement is pretty similar to this one
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 |
|
 |
Bill Woodger
Moderator Emeritus
Joined: 09 Mar 2011 Posts: 7309 Location: Inside the Matrix
|
|
|
|
| That's what PARSE is for. Lots of examples. |
|
| Back to top |
|
 |
daveporcelan
Active Member
Joined: 01 Dec 2006 Posts: 792 Location: Pennsylvania
|
|
|
|
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 |
|
 |
sarbamrit
New User
Joined: 15 Oct 2007 Posts: 12 Location: Kentucky
|
|
|
|
| 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 |
|
 |
Bill Woodger
Moderator Emeritus
Joined: 09 Mar 2011 Posts: 7309 Location: Inside the Matrix
|
|
|
|
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
|
|
| Back to top |
|
 |
dbzTHEdinosauer
Global Moderator

Joined: 20 Oct 2006 Posts: 6965 Location: porcelain throne
|
|
|
|
| sarbamrit wrote: |
| I thought abt PARSE also |
stop thinking about it and read about it.
there are parameters that you can use, so that - avoid using fix position notation
- 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 |
|
 |
sarbamrit
New User
Joined: 15 Oct 2007 Posts: 12 Location: Kentucky
|
|
|
|
| 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
|
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.
will become
will become
will become
whereas I dont want any spaces before my closing bracket.
I'm not sure how to achieve this using PARSE. |
|
| Back to top |
|
 |
Bill Woodger
Moderator Emeritus
Joined: 09 Mar 2011 Posts: 7309 Location: Inside the Matrix
|
|
|
|
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 |
|
 |
Skolusu
Senior Member
Joined: 07 Dec 2007 Posts: 2205 Location: San Jose
|
|
|
|
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 |
|
 |
sarbamrit
New User
Joined: 15 Oct 2007 Posts: 12 Location: Kentucky
|
|
|
|
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 |
|
 |
|
|
 |
All times are GMT + 6 Hours |
|