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
 

 

Need help in sort jcl

 
Post new topic   Reply to topic    IBMMAINFRAMES.com Support Forums -> DFSORT/ICETOOL
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    Post subject: Need help in sort jcl
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

Site Director


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

PostPosted: Tue Aug 25, 2009 8:58 pm    Post subject:
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    Post subject:
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

Site Director


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

PostPosted: Tue Aug 25, 2009 10:00 pm    Post subject:
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 Moderator


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

PostPosted: Tue Aug 25, 2009 10:35 pm    Post subject:
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    Post subject:
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    Post subject:
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 Moderator


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

PostPosted: Wed Aug 26, 2009 9:06 pm    Post subject:
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 Moderator


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

PostPosted: Wed Aug 26, 2009 9:27 pm    Post subject:
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    Post subject:
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    Post subject:
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 Moderator


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

PostPosted: Thu Aug 27, 2009 9:50 pm    Post subject:
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:

http://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    Post subject:
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    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 Limit duplicate records in the SORT pshongal SYNCSORT 6 Mon Nov 21, 2016 12:54 pm
No new posts How to convert the VBM file to VB or... Sulabh Agrawal JCL & VSAM 4 Fri Nov 18, 2016 1:04 pm
No new posts Sort records based on numeric field. Alks SYNCSORT 2 Wed Oct 19, 2016 10:14 pm
No new posts How to delete second instance from Fl... Gunapala CN DFSORT/ICETOOL 6 Tue Oct 18, 2016 11:42 pm
No new posts abend sort based on count records in ... anatol DFSORT/ICETOOL 5 Mon Oct 17, 2016 10:10 pm


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