Skip to content

Instantly share code, notes, and snippets.

View mainframed's full-sized avatar

Soldier of FORTRAN mainframed

View GitHub Profile
@mainframed
mainframed / google_totp.rexx
Created July 29, 2021 02:54
Google TOTP Authenticator in REXX
/* Rexx */
/* z/OS Google Authenticator TOTP POC */
/* Argument: base32 secret key */
/* Output: TOTP Token */
/* Q License */
/* Author Phil 'Soldier of FORTRAN' Young */
NUMERIC DIGITS 10
parse ARG secretkey
@mainframed
mainframed / BASE64.rx
Last active March 20, 2021 09:55
Rexx script to base64 encode files in TSO, OMVS and IXRJCL
/* REXX */
/* Script to base64 encode files on mainframes */
/* -D prints debug messages */
/* In tso: */
/* BASE64 IN.DATA.SET */
/* BASE64 IN.DATA.SET(MEMBER) */
/* BASE64 IN.DATA.SET(MEMBER) OUT.SEQ.DATA.SET <-- MUST BE SEQUENTIAL*/
/* BASE64 IN.DATA.SET(MEMBER) OUT.SEQ.DATA.SET -D */
/* BASE64 IN.DATA.SET(MEMBER) -D */
/* With IXRJCL: */
@mainframed
mainframed / recursive-unxmit-2.0.sh
Created September 17, 2020 20:34
Use rdrprep and recv370 to extract XMI files
#!/bin/bash
#A files with XMI header?
TEMP=$1
XMIT=$2
if [ $# -eq 0 ]
then
echo "[!] Temp dataset argument for XMIT extract required"
@mainframed
mainframed / recursive-unxmit.sh
Created September 15, 2020 20:55
Takes an XMIT file and recursively extracts all embedded xmit files inside
#!/usr/bin/env bash
echo "Recursive unxmit"
while grep -anorb $'\xc9\xd5\xd4\xd9\xf0\xf1' ./|grep -a ":1:2:" ; do
for f in `grep -anorb $'\xc9\xd5\xd4\xd9\xf0\xf1' ./|grep -a ":1:2:"|awk -F: '{print $1}'`; do
folder=`realpath $f`
file=`basename $f`
mkdir -p $folder-dir/bin
mkdir -p $folder-dir/asc
mv $folder $folder-dir
../../recv390/recV390 +binary xpath=$folder-dir/bin $folder-dir/$file
@mainframed
mainframed / JCL
Created July 21, 2020 18:56
wakeupneo.hlasm.jcl
//HELLONEO JOB (ASSY),'WAKE UP NE',CLASS=A,MSGCLASS=Y, 00010001
// NOTIFY=&SYSUID,MSGLEVEL=(1,1) 00020000
//ASM EXEC PROC=HLASMCL 00030000
//SYSIN DD * 00040000
CLR70 TITLE 'C L E A R - TSO' 00050000
PRINT ON,DATA,GEN 00060000
CLEAR CSECT 00080000
* SETUP registers and save areas thanks @bigendiansmalls * 00110000
MAIN STM 14,12,12(13) # Save caller reg 00140000
LR 8,15 # Base register 00150000
[Configuration]
FontName=DejaVu Sans Mono 9
MiscAlwaysShowTabs=FALSE
MiscBell=FALSE
MiscBellUrgent=FALSE
MiscBordersDefault=TRUE
MiscCursorBlinks=FALSE
MiscCursorShape=TERMINAL_CURSOR_SHAPE_BLOCK
MiscDefaultGeometry=120x42
MiscInheritGeometry=FALSE
#!/usr/bin/env python3
from datetime import datetime
import sys
import re
if len(sys.argv) < 6:
print("\nTK4- ANSI art to HLASM Tool\n\nUsage:")
usage = '''{} ansi_file tk4_user source_file_member cursor_x cursor_y > JCL_FILE\n

Simple (LOL) CICS DOGE "Good Morning" screen (i.e. overly complicated hello world)

CICS is like this mystery wrapped in an enigma wrapped in a riddle. Sure you've heard about it, your company might even rely on it day to day for some really important transactions. But if you wanted to quickly learn how to write and deploy a CICS transaction (or application) its basically impossible. Sure you could grab the Murach book, which is great, but its not a 101 level tutorial, they don't even comment about how to use CEDA to install your cics program and mention compiling COBOL and assembling maps in passing.

Throughout this writeup I'm going to refer to CICS like a web server. Yes, i know its the proto-webserver. I don't care, its the roaring 20's. With that in mind, some quick terminology:

  • Transaction: 4 characters long, think of this like a URL. We'll use DOGE as our transaction.
  • Region: This is like "servers". Imagine you had 3 tomcat servers running on different ports, same deal here, except we call th
//COBCOMP JOB 'Compile COBOL',NOTIFY=&SYSUID
//IBMLIB JCLLIB ORDER=DFH520.CICS.SDFHPROC
//* make sure that the PROGLIB in the DFHYITVL is pointed
//* to your CICS loadlib. If you are not sure about this
//* you can go to The JESJCL of the job for your CICS
//* region in Spool and check for DFHRPL dd statement.
//CPLSTP EXEC DFHYITVL,PROGLIB='USER.CICSLOAD',
// INDEX='DFH520.CICS',
// DSCTLIB='DFH520.CICS.SDFHCOB',
// AD370HLQ='IGY520',
@mainframed
mainframed / x3270pro_color_scheme.py
Created November 8, 2019 00:19
Python script to convert the .Xresources color schemes from https://ciembor.github.io/4bit/# to .x3270pro format
#!/usr/bin/env python3
import json
import re
import math
import sys
# From http://jonasjacek.github.io/colors/
map = '[{"colorId":0,"hexString":"#000000","rgb":{"r":0,"g":0,"b":0},"hsl":{"h":0,"s":0,"l":0},"name":"Black"},{"colorId":1,"hexString":"#800000","rgb":{"r":128,"g":0,"b":0},"hsl":{"h":0,"s":100,"l":25},"name":"Maroon"},{"colorId":2,"hexString":"#008000","rgb":{"r":0,"g":128,"b":0},"hsl":{"h":120,"s":100,"l":25},"name":"Green"},{"colorId":3,"hexString":"#808000","rgb":{"r":128,"g":128,"b":0},"hsl":{"h":60,"s":100,"l":25},"name":"Olive"},{"colorId":4,"hexString":"#000080","rgb":{"r":0,"g":0,"b":128},"hsl":{"h":240,"s":100,"l":25},"name":"Navy"},{"colorId":5,"hexString":"#800080","rgb":{"r":128,"g":0,"b":128},"hsl":{"h":300,"s":100,"l":25},"name":"Purple"},{"colorId":6,"hexString":"#008080","rgb":{"r":0,"g":128,"b":128},"hsl":{"h":180,"s":100,"l":25},"name":"Teal"},{"colorId":7,"hexString":"#c0c0c0","rgb":{"r":192,"g":192,"b":192},"hsl":{"h":0,"s":0,"l":75},"name":"Silver"},{"colorId":8,"hexString":"#