View previous topic :: View next topic
|
Author |
Message |
Sandeep D. Patil
New User
Joined: 29 Jun 2008 Posts: 23 Location: mumbai
|
|
|
|
Hi ,
I have a requirement that I have a file which have 2 field one containing the data and other containing the length of the data.
Structure of file
File 1
Col1 Col2
Abc 3
XYZW 2
Consider this is the kind of file so I need to check that weather we can check the length of the col1 data is equal to the col2 value.
For first case it true but for second one its not correct, so I need to change with the actual records length .
Can some one help me in doing this using a JCL?
Thanks in advance |
|
Back to top |
|
|
expat
Global Moderator
Joined: 14 Mar 2007 Posts: 8797 Location: Welsh Wales
|
|
|
|
Quote: |
Can some one help me in doing this using a JCL? |
And which program would you like the JCL to execute.
Please remember that by itself JCL does nothing but to communicate to the processor which program is to be executed, which datasets are to be used for processing, and may also pass parameters to the program. |
|
Back to top |
|
|
Sandeep D. Patil
New User
Joined: 29 Jun 2008 Posts: 23 Location: mumbai
|
|
|
|
Hi ,
Thanks
There are two flat files(PS)
I am using SYNCSORT and i would like to execute the above requirement using sort .
Thanks |
|
Back to top |
|
|
dbzTHEdinosauer
Global Moderator
Joined: 20 Oct 2006 Posts: 6966 Location: porcelain throne
|
|
|
|
1. in your first post you mention that you only have one file,
normally the length precedes the data - how are you going to process this
after you insure that the field length is accurate?
will you have any data that exceeds 9 char?
2. in your second post you mention two files.
what are your requirements? |
|
Back to top |
|
|
Sandeep D. Patil
New User
Joined: 29 Jun 2008 Posts: 23 Location: mumbai
|
|
|
|
No, Actually one if input and one is output file
See the file structure is the same as I mentioned above if the length of the col1 data is equal to the value of the col2 then the prog continues but if the length of the col1 variable does not match with the value of the col2 data then it changes the value of the col2 data with the actual length of the col1 variable
e.g
its reading one by one record in the file
if the length of var1 = var2
continue
else
move length of var1 to var2
Thanks |
|
Back to top |
|
|
dbzTHEdinosauer
Global Moderator
Joined: 20 Oct 2006 Posts: 6966 Location: porcelain throne
|
|
|
|
you did not answer my question about any col1 > 9 char.
and will the always only be one space between col1 and col2?
and what will process the output of the validation/correction step? |
|
Back to top |
|
|
Sandeep D. Patil
New User
Joined: 29 Jun 2008 Posts: 23 Location: mumbai
|
|
|
|
Quote: |
you did not answer my question about any col1 > 9 char.
and will the always only be one space between col1 and col2?
and what will process the output of the validation/correction step? |
Consider this my file declaration
01 file-ip
05 data Pic x(70)
05 length-data pic 9(10)
Now this is the file, and the length of the data may vary from record to record .
I have check for the record length of the data and match with the value of length-data
If correct then no problem it continues and read the next record
If incorrect then change the value of length data with the actual length of the data variable
I Hope this will answer you my question  |
|
Back to top |
|
|
dbzTHEdinosauer
Global Moderator
Joined: 20 Oct 2006 Posts: 6966 Location: porcelain throne
|
|
|
|
will there be any imbedded spaces in the 'data' field?
what char are to be considered as data when determining the length? |
|
Back to top |
|
|
Anuj Dhawan
Superior Member
Joined: 22 Apr 2006 Posts: 6250 Location: Mumbai, India
|
|
|
|
This thread is too confusing -- I read the thread many many times, what's the motive after all? |
|
Back to top |
|
|
Sandeep D. Patil
New User
Joined: 29 Jun 2008 Posts: 23 Location: mumbai
|
|
|
|
No there will not be any spaces |
|
Back to top |
|
|
Sandeep D. Patil
New User
Joined: 29 Jun 2008 Posts: 23 Location: mumbai
|
|
|
|
can any one just tell me how to get the record length of the variable using the sort |
|
Back to top |
|
|
Arun Raj
Moderator
Joined: 17 Oct 2006 Posts: 2481 Location: @my desk
|
|
|
|
Sandeep D. Patil wrote: |
can any one just tell me how to get the record length of the variable using the sort |
Sandeep D. Patil,
If you could tell something about the business requirement behind this, somebody might be able to offer better suggestions. What exactly are you trying to achieve here? Why do you want to find the length of a field? |
|
Back to top |
|
|
dbzTHEdinosauer
Global Moderator
Joined: 20 Oct 2006 Posts: 6966 Location: porcelain throne
|
|
|
|
ok, only one more question:
Quote: |
what char are to be considered as data when determining the length?
|
|
|
Back to top |
|
|
Sandeep D. Patil
New User
Joined: 29 Jun 2008 Posts: 23 Location: mumbai
|
|
|
|
Hi,
I have requirement as we are getting a file from the business and the file contains the data as well as the length of the data …. As mentioned above .
Now my requirement is that I need to check the data is proper or not. Like in case to match the length of the data and the value which I am getting from the business.
Like for e.g.
File 1
Data1 Value1
Pic x(70) Pic 9(10)
ABCD 4
Xyz 4
Now what I want is like that output should come as
o/p
File 2
Data1 Value1
Pic x(70) Pic 9(10)
ABCD 4
Xyz 3
Now I want where ever the length of the data1 is now equal to the value of the length coming from the business I need to change the length as I did in the e.g for the “Xyz”
I hope this would be enough
Thanks |
|
Back to top |
|
|
Sandeep D. Patil
New User
Joined: 29 Jun 2008 Posts: 23 Location: mumbai
|
|
|
|
Please reply |
|
Back to top |
|
|
dbzTHEdinosauer
Global Moderator
Joined: 20 Oct 2006 Posts: 6966 Location: porcelain throne
|
|
Back to top |
|
|
enrico-sorichetti
Superior Member
Joined: 14 Mar 2007 Posts: 10873 Location: italy
|
|
|
|
please do not pester
remember... replying is on
voluntary effort
responder time
no charge
available knowledge
( the only time spent is in replying, not researching )
if You/Your_organization are in need for a fast solution
it would be better to evaluate a pay_for approach |
|
Back to top |
|
|
Arun Raj
Moderator
Joined: 17 Oct 2006 Posts: 2481 Location: @my desk
|
|
|
|
Sandeep D. Patil,
May be you can give this a try.
Code: |
//STEP0100 EXEC PGM=SORT
//SYSOUT DD SYSOUT=*
//SORTIN DD *
AAAAAAAAAAAAAA
BBBBBBBBBB
CCCC
DD
//SORTOUT DD DSN=&&T1,DISP=(,PASS)
//SYSIN DD *
SORT FIELDS=COPY
OUTFIL BUILD=(1,70),FTOV,VLTRIM=C' '
//STEP0200 EXEC PGM=SORT
//SYSOUT DD SYSOUT=*
//SORTIN DD DSN=&&T1,DISP=(OLD,PASS)
//SORTOUT DD SYSOUT=*
//SYSIN DD *
SORT FIELDS=COPY
OUTREC BUILD=(5,70,1,2,BI,SUB,+4,M11,LENGTH=10),VTOF |
SORTOUT
Code: |
----+----1----+----2----+----3----+----4----+----5----+----6----+----7----+----8
AAAAAAAAAAAAAA 0000000014
BBBBBBBBBB 0000000010
CCCC 0000000004
DD 0000000002 |
|
|
Back to top |
|
|
Garry Carroll
Senior Member
Joined: 08 May 2006 Posts: 1193 Location: Dublin, Ireland
|
|
|
|
It seems to me that someone has put the cart before the horse here (ie.e the data befiore its length).
From the description, the length field would appear to be at a varibale location. If so, we first need to know the length of the data so we can locate the field that contains the length!!!. Best of luck with that!
Otherwise we could be looking at a case where the data is a variable-length within a fixed-length field and the length field tells us how much to substring out from that field, in which case the remainder would likely be nulls or blanks.
Garry. |
|
Back to top |
|
|
|