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
 

 

Append second record to first one

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

New User


Joined: 17 Aug 2007
Posts: 29
Location: Brussels

PostPosted: Tue Sep 25, 2007 1:55 pm    Post subject: Append second record to first one
Reply with quote

Hi,

I have a file with just 2 records:

AAA
BBBBB

As a result, I would like to have:

AAABBBB

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..

Thanks.

Julien
Back to top
View user's profile Send private message

murmohk1

Senior Member


Joined: 29 Jun 2006
Posts: 1439
Location: Bangalore,India

PostPosted: Tue Sep 25, 2007 3:10 pm    Post subject:
Reply with quote

Julien,


Code:

//STEPSTEP EXEC PGM=SORT
//SYSPRINT DD SYSOUT=*
//SYSOUT DD SYSOUT=*
//SORTIN DD *                                                       
AAAA                                                               
BBBBBB                                                             
/*                                                                 
//SORTOUT DD SYSOUT=*                                               
//SYSIN DD *                                                       
  SORT FIELDS=COPY                                                 
*                                                                   
  INREC IFTHEN=(WHEN=INIT,OVERLAY=(31:C'1',32:SEQNUM,3,ZD)),       
*                                                                   
        IFTHEN=(WHEN=(32,3,ZD,EQ,2),                               
                 OVERLAY=(35:1,6,1:6C' ',5:35,6,32:10C' ')),       
*                                                                   
         IFTHEN=(WHEN=NONE,OVERLAY=(32:10C' '))                     
/*                                                                 


OP:

Code:
----+----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
Back to top
View user's profile Send private message
krisprems

Active Member


Joined: 27 Nov 2006
Posts: 649
Location: India

PostPosted: Tue Sep 25, 2007 3:44 pm    Post subject:
Reply with quote

julienloc
Based on the i/ps yhat you have specified, i could think of this solution
Code:
//*******************************************************               
//STEP001  EXEC PGM=ICETOOL                                             
//TOOLMSG  DD SYSOUT=*                                                 
//DFSMSG   DD SYSOUT=*                                                 
//IN1      DD *                                                         
AAA                                                                     
BBBBB                                                                   
/*                                                                     
//OUT      DD SYSOUT=*                                                 
//TOOLIN   DD *                                                         
 SPLICE FROM(IN1) TO(OUT) ON(10,1,ZD) -                                 
   WITH(4,5) USING(CP01)                                     
/*                                                                     
//CP01CNTL DD   *                                                       
  INREC  FIELDS=(1,3,1,5,10:C'1')                                       
  OUTFIL BUILD=(1,9)                                                   
/*                                                                     

OUTcontains:
Code:
---+----1
AAABBBBB
Back to top
View user's profile Send private message
julienloc

New User


Joined: 17 Aug 2007
Posts: 29
Location: Brussels

PostPosted: Tue Sep 25, 2007 6:51 pm    Post subject:
Reply with quote

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:

Code:
//S02SORT  EXEC PGM=ICETOOL                                       
//TOOLMSG  DD SYSOUT=*                                             
//DFSMSG   DD SYSOUT=*                                             
//IN       DD DSN=JLO.TEST.FILES.PFJOB1,                           
//         DISP=SHR                                             
//OUT      DD DSN=JLO.TEST.FILES.PFJOB1F,                         
//         DISP=(NEW,CATLG,DELETE),                             
//         SPACE=(TRK,(2,3),RLSE),                             
//         RECFM=FB                                             
//TMP      DD DSN=&&TX,                                           
//         DISP=(MOD,PASS),                                     
//         SPACE=(TRK,(2,3),RLSE),                             
//         DCB=(DSORG=PS,RECFM=FB,LRECL=9)                     
//TOOLIN   DD *                                                   
  COPY   FROM(IN)  TO(TMP) USING(CTL1)                             
  SPLICE FROM(TMP) TO(OUT) ON(9,1,CH) -                           
  WITH(4,5) USING(CTL2)                                         
//*                                                               
//CTL1CNTL DD *                                                   
  OUTREC FIELDS=(1,3,1,5,C'*')                                   
//CTL2CNTL DD *                                                   
  OUTFIL FNAMES=OUT,BUILD=(1,8)
//*
Back to top
View user's profile Send private message
krisprems

Active Member


Joined: 27 Nov 2006
Posts: 649
Location: India

PostPosted: Tue Sep 25, 2007 8:53 pm    Post subject:
Reply with quote

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.
Back to top
View user's profile Send private message
Frank Yaeger

DFSORT Moderator


Joined: 15 Feb 2005
Posts: 7130
Location: San Jose, CA

PostPosted: Tue Sep 25, 2007 9:04 pm    Post subject:
Reply with quote

Julien,

This can be done in one pass with DFSORT's ICETOOL. Try this:

Code:

//S1 EXEC PGM=ICETOOL                           
//TOOLMSG  DD SYSOUT=*                         
//DFSMSG   DD SYSOUT=*                         
//IN DD *                                       
AAA                                             
BBBBB                                           
/*                                             
//OUT DD SYSOUT=*                               
//TOOLIN   DD *                                 
 SPLICE FROM(IN) TO(OUT) ON(9,1,CH) -           
   WITH(4,5) USING(CTL1)                       
/*                                             
//CTL1CNTL DD   *                               
  INREC FIELDS=(1,3,1,5,9:X)                   
  OUTFIL FNAMES=OUT,BUILD=(1,8)                 
/*                                             
Back to top
View user's profile Send private message
julienloc

New User


Joined: 17 Aug 2007
Posts: 29
Location: Brussels

PostPosted: Wed Sep 26, 2007 12:47 pm    Post subject:
Reply with quote

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.

Any clue?

But in any case, the one I provided works.

Thanks.

Julien
Back to top
View user's profile Send private message
krisprems

Active Member


Joined: 27 Nov 2006
Posts: 649
Location: India

PostPosted: Wed Sep 26, 2007 2:17 pm    Post subject:
Reply with quote

julienloc

Quote:
I tried this as Krisprems suggested..but I get an empty dataset as a result.
Just check as to what exactly you tried?
Or paste the Toolin card what you tried!!
Quote:
Are you sure the code works?
The code that i had pasted was a tested one icon_cool.gif
Quote:
I think that the USING(CTL1) is executed after the SPLICE has been done.
The Flow goes this way
first INREC and then the SPLICE and then the OUTFIL
Back to top
View user's profile Send private message
julienloc

New User


Joined: 17 Aug 2007
Posts: 29
Location: Brussels

PostPosted: Wed Sep 26, 2007 3:30 pm    Post subject:
Reply with quote

Hi,

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..

Thanks!

p.s: sorry for the requirement change..

Julien
Back to top
View user's profile Send private message
murmohk1

Senior Member


Joined: 29 Jun 2006
Posts: 1439
Location: Bangalore,India

PostPosted: Wed Sep 26, 2007 4:28 pm    Post subject:
Reply with quote

Julien,

You could use the following -

Code:
//SORTIN DD *                                               
AA234A 533                                                   
CCC2                                                         
77DDD 7 B                                                   
EEEEE                                                       
FFF 456 F3                                                   
/*                                                           
//SORTOUT DD SYSOUT=*                                       
//SYSIN DD *                                                 
  ALTSEQ CODE=(C15A,C25A,C35A,C45A,C55A,C65A,C75A,405A)     
  SORT FIELDS=COPY                                           
  INREC FIELDS=(1,80,TRAN=ALTSEQ)                           
  OUTREC BUILD=(1,30,SQZ=(SHIFT=LEFT,                       
                  PREBLANK=C'!'))                           
/*                                                           



OP:

Code:
*****************
234533           
2               
777             
                 
4563             
*****************


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.

From the above OP, I hope you know what to do.
Back to top
View user's profile Send private message
julienloc

New User


Joined: 17 Aug 2007
Posts: 29
Location: Brussels

PostPosted: Wed Sep 26, 2007 4:49 pm    Post subject:
Reply with quote

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 :-)

Thanks again

Julien
Back to top
View user's profile Send private message
enrico-sorichetti

Global Moderator


Joined: 14 Mar 2007
Posts: 10202
Location: italy

PostPosted: Wed Sep 26, 2007 4:59 pm    Post subject: Reply to: Append second record to first one
Reply with quote

Quote:
In fact my requirement change and becomes more complicated.


I am very curious about the kind of business requirement ...

regards

e.s
Back to top
View user's profile Send private message
julienloc

New User


Joined: 17 Aug 2007
Posts: 29
Location: Brussels

PostPosted: Wed Sep 26, 2007 5:19 pm    Post subject:
Reply with quote

Hi Enrico,

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..

Right? :-)
Back to top
View user's profile Send private message
julienloc

New User


Joined: 17 Aug 2007
Posts: 29
Location: Brussels

PostPosted: Wed Sep 26, 2007 7:19 pm    Post subject:
Reply with quote

Ok guys,

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))

Code:
//S02SORT  EXEC PGM=ICETOOL                                 
//TOOLMSG  DD SYSOUT=*                                       
//DFSMSG   DD SYSOUT=*                                       
//IN       DD DSN=JLO.TEST.FILES.CDJOBF1,                   
//            DISP=SHR                                       
//OUT      DD DSN=JLO.TEST.FILES.CDJOBF2,                   
//            DISP=(NEW,CATLG,DELETE),                       
//            SPACE=(TRK,(2,3),RLSE),                       
//            RECFM=FB                                       
//TMP      DD DSN=&&TX,                                     
//            DISP=(MOD,PASS),                               
//            SPACE=(TRK,(2,3),RLSE),                       
//            DCB=(DSORG=PS,RECFM=FB,LRECL=101)             
//TOOLIN   DD *                                             
  COPY   FROM(IN)  TO(TMP) USING(CTL1)                       
  SPLICE FROM(TMP) TO(OUT) ON(101,1,CH) WITHEACH -           
  WITH(21,20) WITH(41,20) WITH(61,20) WITH(81,20) USING(CTL2)
//*                                                         
//CTL1CNTL DD *                                             
  OUTREC FIELDS=(1,20,1,20,1,20,1,20,1,20,C'*')             
//*                                                         
//CTL2CNTL DD *                                             
  OUTFIL FNAMES=OUT,BUILD=(1,100)                           
//*                                                         


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!

Code:
//IN       DD DSN=JLO.TEST.FILES.CDJOBF1,     
//            DISP=SHR                         
//        DD DSN=JLO.TEST.FILES.BLINES10,     
//           DISP=SHR       




Thanks for your help.

I'll now manage the blank and alphabetic removal with the solution provided before.
Back to top
View user's profile Send private message
Frank Yaeger

DFSORT Moderator


Joined: 15 Feb 2005
Posts: 7130
Location: San Jose, CA

PostPosted: Wed Sep 26, 2007 8:49 pm    Post subject:
Reply with quote

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.

Code:

//S1 EXEC PGM=ICETOOL
//TOOLMSG  DD SYSOUT=*
//DFSMSG   DD SYSOUT=*
//IN DD *
AA234A 533
CCC2
77DDD 7 B   K
EEEEE Z         T U
FFF 456 F3 Q
/*
//OUT DD SYSOUT=*
//TOOLIN   DD *
 SPLICE FROM(IN) TO(OUT) ON(101,1,CH) WITHEACH -
   WITH(21,20) WITH(41,20) WITH(61,20) WITH(81,20) USING(CTL1)
/*
//CTL1CNTL DD   *
  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'),
        1:1,100,SQZ=(SHIFT=LEFT,PREBLANK=C'KLMNOPQRST'),
        1:1,100,SQZ=(SHIFT=LEFT,PREBLANK=C'UVWXYZ')))
/*
Back to top
View user's profile Send private message
julienloc

New User


Joined: 17 Aug 2007
Posts: 29
Location: Brussels

PostPosted: Thu Sep 27, 2007 1:24 pm    Post subject:
Reply with quote

Hi Frank,

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 :-)

Thank you very much for your solution and time.

Julien
Back to top
View user's profile Send private message
Frank Yaeger

DFSORT Moderator


Joined: 15 Feb 2005
Posts: 7130
Location: San Jose, CA

PostPosted: Thu Sep 27, 2007 8:59 pm    Post subject:
Reply with quote

Yes, you need z/OS DFSORT V1R5 PTF UK90007 (April, 2006) to use SQZ. So you apparently have that PTF on one LPAR but not the other.

Code:

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 :-)


Good.
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 How to update a portion of text in a ... Bill Woodger DFSORT/ICETOOL 25 Wed Nov 09, 2016 9:41 pm
No new posts sort with previous record anatol DFSORT/ICETOOL 9 Thu Oct 06, 2016 2:36 am
No new posts Get Record count in summary record fo... Atul Banke DFSORT/ICETOOL 21 Fri Sep 23, 2016 4:17 pm
No new posts Change date (DD/MM/YY) in 2nd record ... uday kiran DFSORT/ICETOOL 12 Wed Sep 07, 2016 10:57 pm
No new posts Using 'parm' to vary SORTOUT record v... Sysaron DFSORT/ICETOOL 13 Wed Sep 07, 2016 9:24 pm


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