Could you please help on this one along with the above requirement:
For the Same Input file (or records), I want to write only the 'V' records with the three key fields of Header & one field from V record itself,into a separate output file.
Suggest you try it and come back if you are stuck and also post the JCL and the error messages. We all will then collectively help you and resolve issues. Believe me you can do this.
Hi Naish,
I have written a COBOL program to do this function (Not sure how to write it in SORT).
I tried using JCL SORT, but do know how to take the key fields from Header and write it to another record. I will try to do some more and will get back to you.
here for syncsort and in the DFSORT section
there are zillions of examples to achieve what you ask for ...
search for the IFTHEN,PUSH,SELECT,BUILD constructs
and You will find something that' s usable with little modifications
Joined: 20 Oct 2006 Posts: 6966 Location: porcelain throne
dinfeo came to the forum for a custom built solution.
you did not give it to him; you actually said 'try to work it out yourself'.
so, he goes to COBOL, which apparently he can use successfully
to accomplish this very complex task.
dinfeo will be back, but not with this thread
= unless of course you provide him with his custom solution =
he will open another thread, with another of these complicated problems,
looking for a custom solution.
You are correct. I wanted to write it in sort and make the process simpler than to go with a COBOL. I am not familiar with techniques in SORT, but will surely learn it.
INREC IFTHEN=(WHEN=GROUP,BEGIN=(18,1,CH,EQ,C'H'),
PUSH=(473:24,2,475:26,4,479:37,10,489:76,4))
INCLUDE COND=(18,1,CH,EQ,C'V')
SORT FIELDS=COPY
OUTREC FIELDS=(1:24,2,3:26,4,7:37,10,17:38,4,21:1,472)
Output is :
1.000000022.1.090022000164319083.010.V.00001.00001.0010000022.1.09999
It is taking the data only from V record. There seems to be an usage of BUILD option for writing a field from one record to another . But I am not finding the explanation for BUILD syntax.
But the output is coming as
1.000000022.1.09 1.000000022.1.09 0001.00001.0010000022.1.09999
1.000000026.1.09 1.000000026.1.09 0001.00001.0010000026.1.09999
I tried with different other changes but still couldn't get it.
dinfeo,
Appreciate that you are trying. But, you should know what GROUP and INIT means and what takes preference when used together. It is detailed in the manual with very good examples.
When initially i tried with the virtual sort position field I got spaces in the first 16 positions.
But now I am able to get that. Thank You once again.
SORTCARD:
=======
INREC IFTHEN=(WHEN=GROUP,BEGIN=(18,1,CH,EQ,C'H'),
PUSH=(473:24,2,475:26,4,479:37,10,489:76,4)),
IFTHEN=(WHEN=(18,1,CH,EQ,C'V'),
OVERLAY=(489:38,4))
Hi Naish,
Made the two requirements under one sort card:
1) To Sort the entire file and write into one file.
2) To Write only required V record on required format.
Joined: 23 Nov 2006 Posts: 19244 Location: Inside the Matrix
Hello,
Please do not post "screenshots" - they take more space and are somewhat cluttered in appearance.
The Code tag will preserve alignment and improve readability. Code'd text appears green on black (like many terminals). There is a Preview function so you can see your post as it will appear to the forum. When you have it looking as you want, Submit.