IBM Mainframe Forum Index
 
Log In
 
IBM Mainframe Forum Index Mainframe: Search IBM Mainframe Forum: FAQ Register
 

How to concatenate string in JCL


IBM Mainframe Forums -> DFSORT/ICETOOL
Post new topic   This topic is locked: you cannot edit posts or make replies.
View previous topic :: View next topic  
Author Message
Ashok09

New User


Joined: 29 Mar 2009
Posts: 20
Location: Chennai

PostPosted: Mon Apr 13, 2009 2:40 pm
Reply with quote

Hi All,

I want to concatenate the two lines in a file.

Ex
input file contains two lines
abc
def

I want the ouput like
abcdef

Using rexx it can be done. But with JCL how to achieve it.

Thanks,
Ashok
Back to top
View user's profile Send private message
expat

Global Moderator


Joined: 14 Mar 2007
Posts: 8794
Location: Welsh Wales

PostPosted: Mon Apr 13, 2009 3:12 pm
Reply with quote

Which program or utility would you like your JCL to execute to achieve this.
Back to top
View user's profile Send private message
Ashok09

New User


Joined: 29 Mar 2009
Posts: 20
Location: Chennai

PostPosted: Mon Apr 13, 2009 3:21 pm
Reply with quote

I want this using Utility like SORT/ICETOOL/ICEMAN or any other utility.Not with programs.

Thanks,
Ashok
Back to top
View user's profile Send private message
Anuj Dhawan

Superior Member


Joined: 22 Apr 2006
Posts: 6250
Location: Mumbai, India

PostPosted: Mon Apr 13, 2009 4:18 pm
Reply with quote

Hi,

Data which you show is kind of not sufficent to start with a solution approach, can you have duplicates, such as:
Code:
ABC
ABC
PQR
PQR
PQR
what should be the output?

What if there are three or more records:
Code:
ABC
DEF
GHI
JKL
MNO
what should be the output? What is LRECL & RECFM of input? Please show a rather complete input.
Back to top
View user's profile Send private message
Ashok09

New User


Joined: 29 Mar 2009
Posts: 20
Location: Chennai

PostPosted: Mon Apr 13, 2009 5:05 pm
Reply with quote

Hi,

No duplicates allowed and right now i hav only 2 records to concatenate.

Im not using file as input.

Im passing the two record like
//IN DD *
abc
def
/*
Back to top
View user's profile Send private message
Frank Yaeger

DFSORT Developer


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

PostPosted: Mon Apr 13, 2009 9:43 pm
Reply with quote

If that's really all you want to do, you can use a DFSORT job like this:

Code:

//S1    EXEC  PGM=SORT
//SYSOUT    DD  SYSOUT=*
//SORTIN DD *
abc
def
/*
//SORTOUT DD SYSOUT=*
//SYSIN    DD    *
  OPTION COPY
  INREC IFTHEN=(WHEN=INIT,OVERLAY=(4:1,3)),
    IFTHEN=(WHEN=GROUP,RECORDS=2,PUSH=(1:1,3))
  OUTFIL STARTREC=2
/*
Back to top
View user's profile Send private message
Ashok09

New User


Joined: 29 Mar 2009
Posts: 20
Location: Chennai

PostPosted: Wed Apr 15, 2009 10:47 am
Reply with quote

I tried ur above code but showing syntax error in WHEN=GROUP

this is how i pass in input
//SORTIN DD *
A
01
12345678
1
1234567890
123456789
/*
Back to top
View user's profile Send private message
Anuj Dhawan

Superior Member


Joined: 22 Apr 2006
Posts: 6250
Location: Mumbai, India

PostPosted: Wed Apr 15, 2009 12:10 pm
Reply with quote

Hi,

1. Are you a DFSORT user or a SyncSort?
2. If SyncSort, which version of it?
3. If DFSORT, you need to have PTF UK90013 for z/OS DFSORT V1R5 (July, 2008) which provides important enhancements to DFSORT and DFSORT's ICETOOL to use group operations (WHEN=GROUP) among others.

You give us nothing to work on, something is "giving syntax error" does not convey anything - you should have posted the complete diagnostic information.
Back to top
View user's profile Send private message
dick scherrer

Moderator Emeritus


Joined: 23 Nov 2006
Posts: 19245
Location: Inside the Matrix

PostPosted: Wed Apr 15, 2009 1:50 pm
Reply with quote

Hello,

Is there some reason y9ou did not post the actual error message code and error text icon_confused.gif
Back to top
View user's profile Send private message
Frank Yaeger

DFSORT Developer


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

PostPosted: Wed Apr 15, 2009 8:51 pm
Reply with quote

Ashok,

You said:

Quote:
No duplicates allowed and right now i hav only 2 records to concatenate.


so I gave you a solution for that.

Now you are showing SORTIN with more than 2 records so you've changed the requirement but not given the needed details of what you're trying to do. The original job was for the original requirement, not this new requirement, whatever it is.

And when you say:

Quote:
I tried ur above code but showing syntax error in WHEN=GROUP


you need to show the //SYSOUT messages you received.
Back to top
View user's profile Send private message
Ashok09

New User


Joined: 29 Mar 2009
Posts: 20
Location: Chennai

PostPosted: Thu Apr 16, 2009 10:39 am
Reply with quote

Frank,

This executed with 2 records. pls find below i Just copied and pasted.

Symbol '$ ' was shown at bottom of WHEN=GROUP.

Think so this mainframe need some patches to support.

********************************* TOP OF DATA **********************************
1ICE143I 0 BLOCKSET COPY TECHNIQUE SELECTED
ICE250I 0 VISIT www.ibm.com/storage/dfsort FOR DFSORT PAPERS, EXAMPLES A
ICE000I 1 - CONTROL STATEMENTS FOR 5694-A01, Z/OS DFSORT V1R5 - 10:33 ON THU AP
0 OPTION COPY
INREC IFTHEN=(WHEN=INIT,OVERLAY=(4:1,3)),
IFTHEN=(WHEN=GROUP,RECORDS=2,PUSH=(1:1,3))
$
ICE007A 0 SYNTAX ERROR
OUTFIL STARTREC=2
ICE751I 0 C5-K05352 C6-Q95214 C7-K90000 C8-K05352 E7-K90000
ICE052I 3 END OF DFSORT
******************************** BOTTOM OF DATA ********************************[/img][/url][/quote]
Back to top
View user's profile Send private message
Ashok09

New User


Joined: 29 Mar 2009
Posts: 20
Location: Chennai

PostPosted: Thu Apr 16, 2009 10:46 am
Reply with quote

Frank,

Using ur above code i thought to implement for more than 2 records by changing some fields in sort card.
Back to top
View user's profile Send private message
Anuj Dhawan

Superior Member


Joined: 22 Apr 2006
Posts: 6250
Location: Mumbai, India

PostPosted: Thu Apr 16, 2009 3:37 pm
Reply with quote

Ashok09 wrote:
..by changing some fields in sort card.
This is nonsense - who knows what you did at your end and after doing that you claim
Quote:
I tried ur above code but showing syntax error in WHEN=GROUP
. . . icon_evil.gif
Back to top
View user's profile Send private message
Frank Yaeger

DFSORT Developer


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

PostPosted: Thu Apr 16, 2009 9:02 pm
Reply with quote

Quote:
Symbol '$ ' was shown at bottom of WHEN=GROUP.

Think so this mainframe need some patches to support.


You need z/OS DFSORT V1R5 PTF UK90013 (July, 2008) to use WHEN=GROUP. Ask your System Programmer to install it.

Quote:
Using ur above code i thought to implement for more than 2 records by changing some fields in sort card.


It doesn't work that way. Your stated requirement was for two records so I set up the job for that. If you have a different requirement, then you need to explain that requirement in detail.
Back to top
View user's profile Send private message
strg.mani

New User


Joined: 21 Jul 2012
Posts: 1
Location: INDIA

PostPosted: Sun Jan 08, 2017 4:12 am
Reply with quote

Hello Frank,

I used your code. It works perfectly fine for me. Can you help me, If the number of records are random but multiple of 2.
For example as following
----+----1----
**************
01DEC16T GB
24:00:00 59797
02DEC16F GB
24:00:00 59831
03DEC16S GB
24:00:00 59862
04DEC16S GB
24:00:00 59883
05DEC16M GB
24:00:00 59903



to the following


----+----1----
**************
01DEC16T 24:00:00 59797
02DEC16F 24:00:00 59831
03DEC16S 24:00:00 59862
04DEC16S 24:00:00 59883
05DEC16M 24:00:00 59903

Please let me know if this is even correct question.
Back to top
View user's profile Send private message
Akatsukami

Global Moderator


Joined: 03 Oct 2009
Posts: 1788
Location: Bloomington, IL

PostPosted: Sun Jan 08, 2017 5:14 am
Reply with quote

Do not tag your question onto a thread that's dormant for over eight years (Mr. Yaeger in fact retired four years ago and has not logged in since.)
Back to top
View user's profile Send private message
View previous topic :: :: View next topic  
Post new topic   This topic is locked: you cannot edit posts or make replies. View Bookmarks
All times are GMT + 6 Hours
Forum Index -> DFSORT/ICETOOL

 


Similar Topics
Topic Forum Replies
No new posts Need to split single line into two li... DFSORT/ICETOOL 7
No new posts how to convert Hex String t char hex PL/I & Assembler 6
No new posts concatenate sysin to dsn JCL & VSAM 7
No new posts Need help to concatenate files with w... All Other Mainframe Topics 3
No new posts Get next 5 numeric from a string of '... COBOL Programming 4
Search our Forums:

Back to Top