Is there a simple way to do that?
What I've found until now is to extract the first record in one file, after extract the second in another one. Then merge the two files record-by-record with the icetool SPLICE option.
This doesn't seem to be the simplest solution to implement..
----+----1----+----2----+----3----+-
***************************** Top of
AAAA 1
BBBBBB 1
**************************** Bottom
Using SPLICE on above OP, you can get your requriement.
Assumptions:
> LRECL 30 assumed for the above sortcard. Please change according to your file lrecl.
> As you said in your post, I assumed your file contains only two records
Thank you very much for your solutions.
I decided to implement the second one..which was simpler.
It was a little trickier..so here the code that actually works:
julienloc
I think you are unnecessarily complicating the process by including 2 CNTL card's, when the same can be accomplished without using the TMP file as i had shown.
I tried this as Krisprems suggested..but I get an empty dataset as a result.
Are you sure the code works?
I think that the USING(CTL1) is executed after the SPLICE has been done.
In fact my requirement change and becomes more complicated.
There could be more than 2 records. We don't know in advance how many. I would like to append all the records (In any case not more that 10) in a big one. Records are 80 LRECL. Also, only numbers should be retained.
For ex:
Input:
AA234A 533
CCC2 77DDD 7 B
EEEEE
FFF 456 F3
Output:
23453327774563
Is that feasible in the same manner? Would the SPLICE work? Or should be put some kind of 'witheach' or something? After I imagine a step removing all non numeric characters. Again, is that feasible?
In any case, I have a Rexx programmer here. This would probably be easier to do in REXX, isn't it? Of course, he may not be available these days for this to be done..
In the ALTSEQ of above sortcard, I had assumed till the alpahbet 'F'. Please add other characters (in hexa) as per your requirement. LRECL assumed is 30.
Thanks for this.
Well, no, I don't know how to append these records..
It seems obvious for 2 records with the SPLICE command.
But for more than 2 records and when we don't know how many records we have..I don't really know..
I'll try to find out, but if someone knows the solution..it would be great to share :-)
It's not a business requirement as such, but as you ask, I will explain you the context of the problem.
We have some CICS transactions which generate dynamically a JCL.
What is dynamic in the JCL is the SYSIN data. The job is part of an application we cannot change (package updates every year). I need this SYSIN data to build a report the application does not generate. The SYSIN data got processed by the application and is lost afterwards.
So I thought of adding a new job in TWS planning that would take as input the JCL :-)
My DFSORT would drop the non-SYSIN data, and afterwards do the processing I explained before.
In the SYSIN data, we do not know in advance how many lines there will be. Important is to extract the numeric values as they represents "departments". Other data are either blanks, or alphabetic description of the departments..
I found a way to concatenate the records in one record.
Initially I thought of:
(this is an test on a dataset with LRECL=20 (instead of 80) and where max number of records is 5 (instead of 10))
The problem with this was that if we have less than 5 records the result is not correct. Let me explain.
Suppose we have input:
11111111111111111111
22222222222222222222
33333333333333333333
44444444444444444444
With the above code, the result will be:
1111111111111111111122222222222222222222333333333333333333334444444444444444444411111111111111111111
That is, the 11111111111111111111 is repeated at the end : [max number of lines - number of input file lines] times.
And because I don't know how many lines I really have, I cannot know how to delete those repetitions.
What I did to manage it is:
Knowing that I have max 5 records, I can append in the IN DD 5 blank lines. Know, instead of incorrect repetition, I have blanks..which I can easily remove afterwards!
Joined: 15 Feb 2005 Posts: 7129 Location: San Jose, CA
Julien,
Even though you ignored my previous post, I'll continue to try to help you.
You can use a DFSORT job like the following to do what you want in one pass. It does NOT have the problem you mentioned. I tested this and it works. If it doesn't work for you, then either you don't have the April, 2006 DFSORT PTF applied, or you changed something incorrectly.
Sorry for your previous reply. I thought it was clear it produced a blank line..
In any case, I found that we haven't the same version installed on our different LPARs. Trying you latest solution on the LPAR I have to build the program, produced an error on SQZ (which shows it does not understand the statement):
Code:
ICE200I 0 IDENTIFIER FROM CALLING PROGRAM IS 0001
ICE143I 0 BLOCKSET SORT TECHNIQUE SELECTED
ICE250I 0 VISIT http://www.ibm.com/storage/dfsort FOR DFSORT PAPERS, EXAMPLES AN
ICE000I 0 - CONTROL STATEMENTS FOR 5694-A01, Z/OS DFSORT V1R5 - 09:42 ON THU SEP
INREC IFTHEN=(WHEN=INIT,OVERLAY=(102:SEQNUM,5,ZD)),
IFTHEN=(WHEN=(102,5,ZD,EQ,+1),BUILD=(1:1,20,101:X)),
IFTHEN=(WHEN=(102,5,ZD,EQ,+2),BUILD=(21:1,20,101:X)),
IFTHEN=(WHEN=(102,5,ZD,EQ,+3),BUILD=(41:1,20,101:X)),
IFTHEN=(WHEN=(102,5,ZD,EQ,+4),BUILD=(61:1,20,101:X)),
IFTHEN=(WHEN=(102,5,ZD,EQ,+5),BUILD=(81:1,20,101:X))
OUTFIL FNAMES=OUT,
IFOUTLEN=100,
IFTHEN=(WHEN=INIT,
OVERLAY=(1:1,100,SQZ=(SHIFT=LEFT,PREBLANK=C'ABCDEFGHIJ'),
$
ICE006A 0 OPERAND DEFINER ERROR
I tried it on another LPAR and it works great!!
Good news, they told me z/os on the first LPAR would be upgraded tomorrow :-)