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

Need help in sort jcl


IBM Mainframe Forums -> DFSORT/ICETOOL
Post new topic   Reply to topic
View previous topic :: View next topic  
Author Message
vicharapusrinu
Warnings : 1

New User


Joined: 04 Dec 2006
Posts: 63
Location: Hyderabad

PostPosted: Tue Aug 25, 2009 8:56 pm
Reply with quote

Could some one help me please?

I have input like this

Code:
----+----1----+----2----+----3
AAAAAAAAAAAAAAAAAAAAAAAAAAAAA
AAAAAAAAAAAAAAAAAAAAAAAAAAAAA
AAAAAAAAAAAAAAAAAACCCCCCCCCCC
AAAAAAAAAAAAAAAAAAAAAAAAAAAAA
AAAAAAAAAAAAAAAAAAAAAAAAAAAAA
AAAAAAAAAAAAAAAAAAAAAAAAAAAAA
AAAAAAAAAAAAAAAAAAAAAAAAAAAAA
AAAAAAAAAAAAAAAAAAAAAAAAAAAAA
AAAAAAAAAAAAAAAAAAAAAAAAAAAAA
AAAAAAAAAAAAAAAAAAACCCCCCCCCC
AAAAAAAAAAAAAAAAAAAAAAAAAAAAA
AAAAAAAAAAAAAAAAAAAAAAAAAAAAA
AAAAAAAAAAAAAAAAAAAAAAAAAAAAA
AAAAAAAAAAAAAAAAAAAAAAAAAAAAA
AAAAAAAAAAAAAAAAAAAAAAAAAAAAA
AAAAAAAAAAAAAAAAAAAMMMMMMMMMM
.......


Expected output
Code:
----+----1----+----2----+----3----+----4----+----5
AAAAAAAAAAAAAAAAAAAAAAAAAAAAA
AAAAAAAAAAAAAAAAAAAAAAAAAAAAA
AAAAAAAAAAAAAAAAAACCCCCCCCCCC     CTEST1
AAAAAAAAAAAAAAAAAAAAAAAAAAAAA
AAAAAAAAAAAAAAAAAAAAAAAAAAAAA
AAAAAAAAAAAAAAAAAAAAAAAAAAAAA
AAAAAAAAAAAAAAAAAAAAAAAAAAAAA
AAAAAAAAAAAAAAAAAAAAAAAAAAAAA
AAAAAAAAAAAAAAAAAAAAAAAAAAAAA
AAAAAAAAAAAAAAAAAAACCCCCCCCCC     CTEST1
AAAAAAAAAAAAAAAAAAAAAAAAAAAAA
AAAAAAAAAAAAAAAAAAAAAAAAAAAAA
AAAAAAAAAAAAAAAAAAAAAAAAAAAAA
AAAAAAAAAAAAAAAAAAAAAAAAAAAAA
AAAAAAAAAAAAAAAAAAAAAAAAAAAAA
AAAAAAAAAAAAAAAAAAAMMMMMMMMMM     MTEST1

Code'd
Back to top
View user's profile Send private message
dick scherrer

Moderator Emeritus


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

PostPosted: Tue Aug 25, 2009 8:58 pm
Reply with quote

Hello,

First - learn to to use the "Code" tag. This preserves alignment and improves readability.

Post the rules for getting to the output from the input.

Mention the relevant data positions as well as the recfm and lrecl of the files.
Back to top
View user's profile Send private message
vicharapusrinu
Warnings : 1

New User


Joined: 04 Dec 2006
Posts: 63
Location: Hyderabad

PostPosted: Tue Aug 25, 2009 9:43 pm
Reply with quote

Sorry for not giving full details in my previous post

Input file properties
FB,LRECL=80

Output file properties
FB, LRECL=86

In input file 29th position to 39th position (inclusive of 29th position to 39th positions ) if “CCCCCCCCCCC” presents then in output file from 35th position to next 6 bytes needs to be filled with CTEST1


In input file 29th position to 39th position (inclusive of 29th position to 39th positions ) if “MMMMMMMMMMM” presents then in output file from 35th position to next 6 bytes needs to be filled with MTEST1

In input file 29th position to 39th position (inclusive of 29th position to 39th positions ) if “QQQQQQQQQQQ” presents then in output file from 35th position to next 6 bytes needs to be filled with QTEST1


So on……
Back to top
View user's profile Send private message
dick scherrer

Moderator Emeritus


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

PostPosted: Tue Aug 25, 2009 10:00 pm
Reply with quote

Hello,

The sample data appears to have the CCC, MMM, beginning in pos 19 icon_confused.gif

Far better to be accurate rather than fast icon_wink.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: Tue Aug 25, 2009 10:35 pm
Reply with quote

vicharapusrinu,

You can use a DFSORT job like the following to do what you asked for. I assumed you actually had the targets in 19-29 and used input records that matched that assumption.

Code:

//S1    EXEC  PGM=SORT
//SYSOUT    DD  SYSOUT=*
//SORTIN DD *
AAAAAAAAAAAAAAAAAAAAAAAAAAAAA
AAAAAAAAAAAAAAAAAACCCCCCCCCCC
AAAAAAAAAAAAAAAAAAAAAAAAAAAAA
AAAAAAAAAAAAAAAAAAAAAAAAAAAAA
AAAAAAAAAAAAAAAAAACCCCCCCCCCC
AAAAAAAAAAAAAAAAAAAAAAAAAAAAA
AAAAAAAAAAAAAAAAAAAAAAAAAAAAA
AAAAAAAAAAAAAAAAAAQQQQQQQQQQQ
AAAAAAAAAAAAAAAAAAAAAAAAAAAAA
AAAAAAAAAAAAAAAAAAMMMMMMMMMMM
//SORTOUT DD SYSOUT=*
//SYSIN    DD    *
  OPTION COPY
  INREC IFTHEN=(WHEN=(19,11,CH,EQ,C'CCCCCCCCCCC'),
    OVERLAY=(35:C'CTEST1')),
   IFTHEN=(WHEN=(19,11,CH,EQ,C'MMMMMMMMMMM'),
    OVERLAY=(35:C'MTEST1')),
   IFTHEN=(WHEN=(19,11,CH,EQ,C'QQQQQQQQQQQ'),
    OVERLAY=(35:C'QTEST1'))
/*


SORTOUT would have:

Code:

AAAAAAAAAAAAAAAAAAAAAAAAAAAAA                 
AAAAAAAAAAAAAAAAAACCCCCCCCCCC     CTEST1       
AAAAAAAAAAAAAAAAAAAAAAAAAAAAA                 
AAAAAAAAAAAAAAAAAAAAAAAAAAAAA                 
AAAAAAAAAAAAAAAAAACCCCCCCCCCC     CTEST1       
AAAAAAAAAAAAAAAAAAAAAAAAAAAAA                 
AAAAAAAAAAAAAAAAAAAAAAAAAAAAA                 
AAAAAAAAAAAAAAAAAAQQQQQQQQQQQ     QTEST1       
AAAAAAAAAAAAAAAAAAAAAAAAAAAAA                 
AAAAAAAAAAAAAAAAAAMMMMMMMMMMM     MTEST1       
Back to top
View user's profile Send private message
vicharapusrinu
Warnings : 1

New User


Joined: 04 Dec 2006
Posts: 63
Location: Hyderabad

PostPosted: Wed Aug 26, 2009 3:01 pm
Reply with quote

Frank Yaeger,

Thanks a lot for your response,

I have got one more requirement

If “CCCCCCCCCCC” is not appear from 19th position to 29th position then 6 spaces need to be moved to instead of CTEST1
...............
So on……….

please help me out
Back to top
View user's profile Send private message
Escapa

Senior Member


Joined: 16 Feb 2007
Posts: 1399
Location: IL, USA

PostPosted: Wed Aug 26, 2009 4:22 pm
Reply with quote

isn't it is happening currently by code given by Frank?

I am able to see SPACES when 19th to 29th position value is “AAAAAAAAAAA” icon_rolleyes.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 Aug 26, 2009 9:06 pm
Reply with quote

Quote:
If “CCCCCCCCCCC” is not appear from 19th position to 29th position then 6 spaces need to be moved to instead of CTEST1


My job does leave spaces in those positions when the IFTHEN conditions are not met.
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 Aug 26, 2009 9:27 pm
Reply with quote

I'm making the assumption that you have blanks in the records at the location where CTEST1 etc goes.

If, in fact, you have something else in those positions and want to overlay it with blanks, show an example of your input records and expected output records and I'll show you how to do what you want.
Back to top
View user's profile Send private message
vicharapusrinu
Warnings : 1

New User


Joined: 04 Dec 2006
Posts: 63
Location: Hyderabad

PostPosted: Thu Aug 27, 2009 10:46 am
Reply with quote

Frank Yaeger,

Thanks a lot for your support

Here is my input and expected out put

Code:
INPUT FILE
----+----1----+----2----+----3----+----4-
MMMMMMMMMM010000001411089156ABCD123456  A
OOOOOOOOOO010000005410918667ABCD206111  A
0120090730010000006410889243ACSONCUS2   A
0120090730010000018411081513AP00001     A




EXPECTED OUTPUT
----+----1----+----2----+----3----+----4----+----5----+----6
MMMMMMMMMM0100000014TESTM11089156ABCD123456  A
OOOOOOOOOO0100000054TESTO10918667ABCD206111  A
01200907300100000064     10889243ACSONCUS2   A
01200907300100000184     11081513AP00001     A



Input file properties
LRECL 498, FB

Out put file properties
LRECL 503, FB
[/code]
Back to top
View user's profile Send private message
vicharapusrinu
Warnings : 1

New User


Joined: 04 Dec 2006
Posts: 63
Location: Hyderabad

PostPosted: Thu Aug 27, 2009 7:37 pm
Reply with quote

Frank Yaeger/ All,

Could some one help me please?

My requirement is to insert some text in between of file

Input file LRECL = 498
Output file LRECL = 503

If in input file from 1st position to 10th position if it founds MMMMMMMMMM then in out put file TESTM should appear from 21st position and rest of input record should start from 26th position (no over writing of data)

AND

If in input file from 1st position to 10th position if it NOT founds MMMMMMMMMM then in out put file 5 SPACES should appear from 21st position and rest of input record should start from 26th position(no over writing of data)

Input and expected output lay outs are in above post…

Could some one help me please?
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 Aug 27, 2009 9:50 pm
Reply with quote

Be patient. I'm in California - I just got to work. If you want faster help, explain your requirements more clearly in your first post.

You might also try to figure things out yourself (I assume that's what you're being paid for). I'd suggest reading through "z/OS DFSORT: Getting Started". It's an excellent tutorial, with lots of examples, that will show you how to use DFSORT, DFSORT's ICETOOL and DFSORT Symbols. You can access it online, along with all of the other DFSORT books, from:

www.ibm.com/support/docview.wss?rs=114&uid=isg3T7000080

Here's a DFSORT job for your new requirement:

Code:

//S1    EXEC  PGM=SORT
//SYSOUT    DD  SYSOUT=*
//SORTIN DD DSN=...  input file (FB/498)
//SORTOUT DD DSN=...  output file (FB/503)
//SYSIN    DD    *
  OPTION COPY
  INREC IFTHEN=(WHEN=INIT,BUILD=(1,20,26:21,478)),
   IFTHEN=(WHEN=(1,10,CH,EQ,C'MMMMMMMMMM'),
    OVERLAY=(21:C'TESTM')),
   IFTHEN=(WHEN=(1,10,CH,EQ,C'OOOOOOOOOO'),
    OVERLAY=(21:C'TESTO'))
/*
Back to top
View user's profile Send private message
vicharapusrinu
Warnings : 1

New User


Joined: 04 Dec 2006
Posts: 63
Location: Hyderabad

PostPosted: Thu Aug 27, 2009 11:23 pm
Reply with quote

Frank Yaeger,

Thanks a lot for help, it is working fine. icon_lol.gif

I will go through document "z/OS DFSORT: Getting Started".
Back to top
View user's profile Send private message
View previous topic :: :: View next topic  
Post new topic   Reply to topic View Bookmarks
All times are GMT + 6 Hours
Forum Index -> DFSORT/ICETOOL

 


Similar Topics
Topic Forum Replies
No new posts Need to set RC4 through JCL SORT DFSORT/ICETOOL 5
No new posts How to split large record length file... DFSORT/ICETOOL 10
No new posts JCL sort card - get first day and las... JCL & VSAM 9
No new posts Sort First/last record of a subset th... DFSORT/ICETOOL 7
No new posts how to calculate SUM value for VB fil... DFSORT/ICETOOL 1
Search our Forums:

Back to Top